author | Wuzzy <Wuzzy2@mail.ru> |
Tue, 06 Mar 2018 04:11:17 +0100 | |
changeset 13083 | e5df2a3911f4 |
parent 12383 | e3d9abcc427a |
permissions | -rw-r--r-- |
9677 | 1 |
# - Locate SDL2_net library |
2 |
# This module defines: |
|
3 |
# SDL2_NET_LIBRARIES, the name of the library to link against |
|
4 |
# SDL2_NET_INCLUDE_DIRS, where to find the headers |
|
5 |
# SDL2_NET_FOUND, if false, do not try to link against |
|
6 |
# SDL2_NET_VERSION_STRING - human-readable string containing the version of SDL2_net |
|
7 |
# |
|
8 |
# For backward compatiblity the following variables are also set: |
|
9 |
# SDL2NET_LIBRARY (same value as SDL2_NET_LIBRARIES) |
|
10 |
# SDL2NET_INCLUDE_DIR (same value as SDL2_NET_INCLUDE_DIRS) |
|
11 |
# SDL2NET_FOUND (same value as SDL2_NET_FOUND) |
|
12 |
# |
|
13 |
# $SDL2DIR is an environment variable that would |
|
14 |
# correspond to the ./configure --prefix=$SDL2DIR |
|
15 |
# used in building SDL2. |
|
16 |
# |
|
17 |
# Created by Eric Wing. This was influenced by the FindSDL2.cmake |
|
18 |
# module, but with modifications to recognize OS X frameworks and |
|
19 |
# additional Unix paths (FreeBSD, etc). |
|
20 |
||
21 |
#============================================================================= |
|
22 |
# Copyright 2005-2009 Kitware, Inc. |
|
23 |
# Copyright 2012 Benjamin Eikel |
|
24 |
# |
|
25 |
# Distributed under the OSI-approved BSD License (the "License"); |
|
26 |
# see accompanying file Copyright.txt for details. |
|
27 |
# |
|
28 |
# This software is distributed WITHOUT ANY WARRANTY; without even the |
|
29 |
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
30 |
# See the License for more information. |
|
31 |
#============================================================================= |
|
32 |
# (To distribute this file outside of CMake, substitute the full |
|
33 |
# License text for the above reference.) |
|
34 |
||
35 |
if(NOT SDL2_NET_INCLUDE_DIR AND SDL2NET_INCLUDE_DIR) |
|
36 |
set(SDL2_NET_INCLUDE_DIR ${SDL2NET_INCLUDE_DIR} CACHE PATH "directory cache |
|
37 |
entry initialized from old variable name") |
|
38 |
endif() |
|
39 |
find_path(SDL2_NET_INCLUDE_DIR SDL_net.h |
|
40 |
HINTS |
|
41 |
ENV SDL2NETDIR |
|
42 |
ENV SDL2DIR |
|
43 |
PATH_SUFFIXES include/SDL2 include |
|
44 |
) |
|
45 |
||
46 |
if(NOT SDL2_NET_LIBRARY AND SDL2NET_LIBRARY) |
|
47 |
set(SDL2_NET_LIBRARY ${SDL2NET_LIBRARY} CACHE FILEPATH "file cache entry |
|
48 |
initialized from old variable name") |
|
49 |
endif() |
|
50 |
find_library(SDL2_NET_LIBRARY |
|
51 |
NAMES SDL2_net |
|
52 |
HINTS |
|
53 |
ENV SDL2NETDIR |
|
54 |
ENV SDL2DIR |
|
55 |
PATH_SUFFIXES lib |
|
56 |
) |
|
57 |
||
12383 | 58 |
if(SDL2_NET_INCLUDE_DIR AND EXISTS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h") |
59 |
file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+[0-9]+$") |
|
60 |
file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+[0-9]+$") |
|
61 |
file(STRINGS "${SDL2_NET_INCLUDE_DIR}/SDL_net.h" SDL2_NET_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+[0-9]+$") |
|
62 |
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_MAJOR "${SDL2_NET_VERSION_MAJOR_LINE}") |
|
63 |
string(REGEX REPLACE "^#define[ \t]+SDL_NET_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_MINOR "${SDL2_NET_VERSION_MINOR_LINE}") |
|
64 |
string(REGEX REPLACE "^#define[ \t]+SDL_NET_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_NET_VERSION_PATCH "${SDL2_NET_VERSION_PATCH_LINE}") |
|
9677 | 65 |
set(SDL2_NET_VERSION_STRING ${SDL2_NET_VERSION_MAJOR}.${SDL2_NET_VERSION_MINOR}.${SDL2_NET_VERSION_PATCH}) |
66 |
unset(SDL2_NET_VERSION_MAJOR_LINE) |
|
67 |
unset(SDL2_NET_VERSION_MINOR_LINE) |
|
68 |
unset(SDL2_NET_VERSION_PATCH_LINE) |
|
69 |
unset(SDL2_NET_VERSION_MAJOR) |
|
70 |
unset(SDL2_NET_VERSION_MINOR) |
|
71 |
unset(SDL2_NET_VERSION_PATCH) |
|
72 |
endif() |
|
73 |
||
74 |
set(SDL2_NET_LIBRARIES ${SDL2_NET_LIBRARY}) |
|
75 |
set(SDL2_NET_INCLUDE_DIRS ${SDL2_NET_INCLUDE_DIR}) |
|
76 |
||
11657
ae6706411b24
Hijack SDL2 and GLEW include and library when compiling to javascript
koda
parents:
9677
diff
changeset
|
77 |
if(BUILD_ENGINE_JS) |
ae6706411b24
Hijack SDL2 and GLEW include and library when compiling to javascript
koda
parents:
9677
diff
changeset
|
78 |
set(SDL2_NET_LIBRARY "sdl2_net_emscripten_internal") |
ae6706411b24
Hijack SDL2 and GLEW include and library when compiling to javascript
koda
parents:
9677
diff
changeset
|
79 |
set(SDL2_NET_LIBRARIES "sdl2_net_emscripten_internal") |
ae6706411b24
Hijack SDL2 and GLEW include and library when compiling to javascript
koda
parents:
9677
diff
changeset
|
80 |
set(SDL2_NET_INCLUDE_DIRS "${CMAKE_SYSTEM_INCLUDE_PATH}/SDL") |
ae6706411b24
Hijack SDL2 and GLEW include and library when compiling to javascript
koda
parents:
9677
diff
changeset
|
81 |
endif() |
ae6706411b24
Hijack SDL2 and GLEW include and library when compiling to javascript
koda
parents:
9677
diff
changeset
|
82 |
|
9677 | 83 |
include(FindPackageHandleStandardArgs) |
84 |
||
85 |
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_net |
|
86 |
REQUIRED_VARS SDL2_NET_LIBRARIES SDL2_NET_INCLUDE_DIRS |
|
87 |
VERSION_VAR SDL2_NET_VERSION_STRING) |
|
88 |
||
89 |
# for backward compatiblity |
|
12383 | 90 |
set(SDLNET_LIBRARY ${SDL2_NET_LIBRARIES}) |
91 |
set(SDLNET_INCLUDE_DIR ${SDL2_NET_INCLUDE_DIRS}) |
|
92 |
set(SDLNET_FOUND ${SDL2_NET_FOUND}) |
|
9677 | 93 |
|
94 |
mark_as_advanced(SDL2_NET_LIBRARY SDL2_NET_INCLUDE_DIR) |