diff options
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | appveyor.yml | 5 | ||||
-rw-r--r-- | cmake/Dependencies.cmake | 77 | ||||
-rw-r--r-- | cmake/FindThreads.cmake | 255 | ||||
-rw-r--r-- | cmake/Findsodium.cmake | 288 | ||||
-rw-r--r-- | cmake/ModulePackage.cmake | 10 | ||||
-rw-r--r-- | cmake/SimpleFindPackage.cmake | 37 | ||||
-rw-r--r-- | toxav/msi.c | 1 |
8 files changed, 57 insertions, 623 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 72d9246f..47d5e372 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -168,7 +168,7 @@ set(toxcore_SOURCES ${toxcore_SOURCES} | |||
168 | include(CheckFunctionExists) | 168 | include(CheckFunctionExists) |
169 | check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO) | 169 | check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO) |
170 | check_function_exists(memset_s HAVE_MEMSET_S) | 170 | check_function_exists(memset_s HAVE_MEMSET_S) |
171 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} sodium) | 171 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${LIBSODIUM_LIBRARIES}) |
172 | set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} libsodium) | 172 | set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} libsodium) |
173 | 173 | ||
174 | # LAYER 2: Basic networking | 174 | # LAYER 2: Basic networking |
@@ -275,7 +275,7 @@ if(BUILD_TOXAV) | |||
275 | toxav/toxav_old.c | 275 | toxav/toxav_old.c |
276 | toxav/video.c | 276 | toxav/video.c |
277 | toxav/video.h) | 277 | toxav/video.h) |
278 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} Opus::Opus Vpx::Vpx) | 278 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${OPUS_LIBRARIES} ${VPX_LIBRARIES}) |
279 | set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} opus vpx) | 279 | set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} opus vpx) |
280 | 280 | ||
281 | set(toxcore_API_HEADERS ${toxcore_API_HEADERS} ${toxcore_SOURCE_DIR}/toxav/toxav.h^toxav) | 281 | set(toxcore_API_HEADERS ${toxcore_API_HEADERS} ${toxcore_SOURCE_DIR}/toxav/toxav.h^toxav) |
@@ -304,10 +304,11 @@ set(toxcore_API_HEADERS ${toxcore_API_HEADERS} ${toxcore_SOURCE_DIR}/toxencrypts | |||
304 | # any potential libvpx linking. | 304 | # any potential libvpx linking. |
305 | message("CMAKE_THREAD_LIBS_INIT: ${CMAKE_THREAD_LIBS_INIT}") | 305 | message("CMAKE_THREAD_LIBS_INIT: ${CMAKE_THREAD_LIBS_INIT}") |
306 | if(CMAKE_THREAD_LIBS_INIT) | 306 | if(CMAKE_THREAD_LIBS_INIT) |
307 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} Threads::Threads) | 307 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${CMAKE_THREAD_LIBS_INIT}) |
308 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} ${CMAKE_THREAD_LIBS_INIT}) | 308 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} ${CMAKE_THREAD_LIBS_INIT}) |
309 | endif() | 309 | endif() |
310 | 310 | ||
311 | |||
311 | if(NSL_LIBRARIES) | 312 | if(NSL_LIBRARIES) |
312 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${NSL_LIBRARIES}) | 313 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${NSL_LIBRARIES}) |
313 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lnsl) | 314 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} -lnsl) |
diff --git a/appveyor.yml b/appveyor.yml index 8353352b..1b5227e3 100644 --- a/appveyor.yml +++ b/appveyor.yml | |||
@@ -18,13 +18,10 @@ install: | |||
18 | - mkdir pthreads-win32 && cd pthreads-win32 | 18 | - mkdir pthreads-win32 && cd pthreads-win32 |
19 | - if not exist %APPDATA%\downloads\pthreads.zip curl -L ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip -o %APPDATA%\downloads\pthreads.zip | 19 | - if not exist %APPDATA%\downloads\pthreads.zip curl -L ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip -o %APPDATA%\downloads\pthreads.zip |
20 | - unzip %APPDATA%\downloads\pthreads.zip | 20 | - unzip %APPDATA%\downloads\pthreads.zip |
21 | - copy Pre-built.2\lib\x86\* Pre-built.2\lib\ | ||
22 | - cd ../.. | 21 | - cd ../.. |
23 | 22 | ||
24 | # TODO(sphaerophoria): currently don't have prebuilt libraries for libvpx and | ||
25 | # libopus so we will just build with BUILD_TOXAV=OFF for now. | ||
26 | before_build: | 23 | before_build: |
27 | - cmake -B_build -H. -DBOOTSTRAP_DAEMON=OFF -DENABLE_SHARED=OFF -DBUILD_TOXAV=OFF -DTEST_TIMEOUT_SECONDS=120 -DCMAKE_PREFIX_PATH="third_party\pthreads-win32\Pre-built.2;third_party\libsodium" | 24 | - cmake -B_build -H. -DBOOTSTRAP_DAEMON=OFF -DENABLE_SHARED=OFF -DBUILD_TOXAV=OFF -DTEST_TIMEOUT_SECONDS=120 |
28 | 25 | ||
29 | build: | 26 | build: |
30 | project: _build/INSTALL.vcxproj | 27 | project: _build/INSTALL.vcxproj |
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index c641e094..5970fde7 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake | |||
@@ -5,44 +5,19 @@ | |||
5 | ############################################################################### | 5 | ############################################################################### |
6 | 6 | ||
7 | include(ModulePackage) | 7 | include(ModulePackage) |
8 | include(SimpleFindPackage) | ||
9 | |||
10 | if (MSVC) | ||
11 | set(THREADS_USE_PTHREADS_WIN32 1) | ||
12 | endif() | ||
13 | 8 | ||
14 | find_package(Threads REQUIRED) | 9 | find_package(Threads REQUIRED) |
15 | 10 | ||
16 | if (MSVC) | ||
17 | set_property(TARGET Threads::Threads APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "HAVE_STRUCT_TIMESPEC") | ||
18 | endif() | ||
19 | |||
20 | find_library(NSL_LIBRARIES nsl ) | 11 | find_library(NSL_LIBRARIES nsl ) |
21 | find_library(RT_LIBRARIES rt ) | 12 | find_library(RT_LIBRARIES rt ) |
22 | find_library(SOCKET_LIBRARIES socket ) | 13 | find_library(SOCKET_LIBRARIES socket ) |
23 | 14 | ||
24 | # For toxcore. | 15 | # For toxcore. |
25 | 16 | pkg_use_module(LIBSODIUM libsodium ) | |
26 | # Try to find both static and shared variants of sodium | ||
27 | set(sodium_USE_STATIC_LIBS OFF) | ||
28 | find_package(sodium) | ||
29 | if (NOT TARGET sodium) | ||
30 | set(sodium_USE_STATIC_LIBS ON) | ||
31 | find_package(sodium REQUIRED) | ||
32 | endif() | ||
33 | 17 | ||
34 | # For toxav. | 18 | # For toxav. |
35 | simple_find_package(Opus | 19 | pkg_use_module(OPUS opus ) |
36 | PKGCFG_NAME opus | 20 | pkg_use_module(VPX vpx ) |
37 | INCLUDE_NAMES opus.h | ||
38 | PATH_SUFFIXES opus | ||
39 | LIB_NAMES opus) | ||
40 | |||
41 | simple_find_package(Vpx | ||
42 | PKGCFG_NAME vpx | ||
43 | INCLUDE_NAMES vpx_codec.h | ||
44 | PATH_SUFFIXES vpx | ||
45 | LIB_NAMES vpx vpxmd) | ||
46 | 21 | ||
47 | # For tox-bootstrapd. | 22 | # For tox-bootstrapd. |
48 | pkg_use_module(LIBCONFIG libconfig ) | 23 | pkg_use_module(LIBCONFIG libconfig ) |
@@ -54,3 +29,49 @@ pkg_use_module(MSGPACK msgpack ) | |||
54 | pkg_use_module(OPENCV opencv ) | 29 | pkg_use_module(OPENCV opencv ) |
55 | pkg_use_module(PORTAUDIO portaudio-2.0) | 30 | pkg_use_module(PORTAUDIO portaudio-2.0) |
56 | pkg_use_module(SNDFILE sndfile ) | 31 | pkg_use_module(SNDFILE sndfile ) |
32 | |||
33 | ############################################################################### | ||
34 | # | ||
35 | # :: For MSVC Windows builds. | ||
36 | # | ||
37 | # These require specific installation paths of dependencies: | ||
38 | # - libsodium in third-party/libsodium/Win32/Release/v140/dynamic | ||
39 | # - pthreads in third-party/pthreads-win32/Pre-built.2 | ||
40 | # | ||
41 | ############################################################################### | ||
42 | |||
43 | if(MSVC) | ||
44 | # libsodium | ||
45 | # --------- | ||
46 | find_library(LIBSODIUM_LIBRARIES | ||
47 | NAMES sodium libsodium | ||
48 | PATHS | ||
49 | "third_party/libsodium/Win32/Release/v140/dynamic" | ||
50 | "third_party/libsodium/x64/Release/v140/dynamic" | ||
51 | ) | ||
52 | if(LIBSODIUM_LIBRARIES) | ||
53 | include_directories("third_party/libsodium/include") | ||
54 | set(LIBSODIUM_FOUND TRUE) | ||
55 | message("libsodium: ${LIBSODIUM_LIBRARIES}") | ||
56 | else() | ||
57 | message(FATAL_ERROR "libsodium libraries not found") | ||
58 | endif() | ||
59 | |||
60 | # pthreads | ||
61 | # -------- | ||
62 | if(CMAKE_USE_WIN32_THREADS_INIT) | ||
63 | find_library(CMAKE_THREAD_LIBS_INIT | ||
64 | NAMES pthreadVC2 | ||
65 | PATHS | ||
66 | "third_party/pthreads-win32/Pre-built.2/lib/x86" | ||
67 | "third_party/pthreads-win32/Pre-built.2/lib/x64" | ||
68 | ) | ||
69 | if(CMAKE_THREAD_LIBS_INIT) | ||
70 | include_directories("third_party/pthreads-win32/Pre-built.2/include") | ||
71 | add_definitions(-DHAVE_STRUCT_TIMESPEC) | ||
72 | message("libpthreads: ${CMAKE_THREAD_LIBS_INIT}") | ||
73 | else() | ||
74 | message(FATAL_ERROR "libpthreads libraries not found") | ||
75 | endif() | ||
76 | endif() | ||
77 | endif() | ||
diff --git a/cmake/FindThreads.cmake b/cmake/FindThreads.cmake deleted file mode 100644 index 11c0aec6..00000000 --- a/cmake/FindThreads.cmake +++ /dev/null | |||
@@ -1,255 +0,0 @@ | |||
1 | # Updated FindThreads.cmake that supports pthread-win32 | ||
2 | # Downloaded from http://www.vtk.org/Bug/bug_view_advanced_page.php?bug_id=6399 | ||
3 | |||
4 | # - This module determines the thread library of the system. | ||
5 | # | ||
6 | # The following variables are set | ||
7 | # CMAKE_THREAD_LIBS_INIT - the thread library | ||
8 | # CMAKE_USE_SPROC_INIT - are we using sproc? | ||
9 | # CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads? | ||
10 | # CMAKE_USE_PTHREADS_INIT - are we using pthreads | ||
11 | # CMAKE_HP_PTHREADS_INIT - are we using hp pthreads | ||
12 | # | ||
13 | # If use of pthreads-win32 is desired, the following variables | ||
14 | # can be set. | ||
15 | # | ||
16 | # THREADS_USE_PTHREADS_WIN32 - | ||
17 | # Setting this to true searches for the pthreads-win32 | ||
18 | # port (since CMake 2.8.0) | ||
19 | # | ||
20 | # THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME | ||
21 | # C = no exceptions (default) | ||
22 | # (NOTE: This is the default scheme on most POSIX thread | ||
23 | # implementations and what you should probably be using) | ||
24 | # CE = C++ Exception Handling | ||
25 | # SE = Structure Exception Handling (MSVC only) | ||
26 | # (NOTE: Changing this option from the default may affect | ||
27 | # the portability of your application. See pthreads-win32 | ||
28 | # documentation for more details.) | ||
29 | # | ||
30 | #====================================================== | ||
31 | # Example usage where threading library | ||
32 | # is provided by the system: | ||
33 | # | ||
34 | # find_package(Threads REQUIRED) | ||
35 | # add_executable(foo foo.cc) | ||
36 | # target_link_libraries(foo ${CMAKE_THREAD_LIBS_INIT}) | ||
37 | # | ||
38 | # Example usage if pthreads-win32 is desired on Windows | ||
39 | # or a system provided thread library: | ||
40 | # | ||
41 | # set(THREADS_USE_PTHREADS_WIN32 true) | ||
42 | # find_package(Threads REQUIRED) | ||
43 | # include_directories(${THREADS_PTHREADS_INCLUDE_DIR}) | ||
44 | # | ||
45 | # add_executable(foo foo.cc) | ||
46 | # target_link_libraries(foo ${CMAKE_THREAD_LIBS_INIT}) | ||
47 | # | ||
48 | |||
49 | INCLUDE (CheckIncludeFiles) | ||
50 | INCLUDE (CheckLibraryExists) | ||
51 | SET(Threads_FOUND FALSE) | ||
52 | |||
53 | IF(WIN32 AND NOT CYGWIN AND THREADS_USE_PTHREADS_WIN32) | ||
54 | SET(_Threads_ptwin32 true) | ||
55 | ENDIF() | ||
56 | |||
57 | # Do we have sproc? | ||
58 | IF(CMAKE_SYSTEM MATCHES IRIX) | ||
59 | CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h" CMAKE_HAVE_SPROC_H) | ||
60 | ENDIF() | ||
61 | |||
62 | IF(CMAKE_HAVE_SPROC_H) | ||
63 | # We have sproc | ||
64 | SET(CMAKE_USE_SPROC_INIT 1) | ||
65 | |||
66 | ELSEIF(_Threads_ptwin32) | ||
67 | |||
68 | IF(NOT DEFINED THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME) | ||
69 | # Assign the default scheme | ||
70 | SET(THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME "C") | ||
71 | ELSE() | ||
72 | # Validate the scheme specified by the user | ||
73 | IF(NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "C" AND | ||
74 | NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "CE" AND | ||
75 | NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE") | ||
76 | MESSAGE(FATAL_ERROR "See documentation for FindPthreads.cmake, only C, CE, and SE modes are allowed") | ||
77 | ENDIF() | ||
78 | IF(NOT MSVC AND THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE") | ||
79 | MESSAGE(FATAL_ERROR "Structured Exception Handling is only allowed for MSVC") | ||
80 | ENDIF(NOT MSVC AND THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE") | ||
81 | ENDIF() | ||
82 | |||
83 | FIND_PATH(THREADS_PTHREADS_INCLUDE_DIR pthread.h) | ||
84 | |||
85 | # Determine the library filename | ||
86 | IF(MSVC) | ||
87 | SET(_Threads_pthreads_libname | ||
88 | pthreadV${THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME}2) | ||
89 | ELSEIF(MINGW) | ||
90 | SET(_Threads_pthreads_libname | ||
91 | pthreadG${THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME}2) | ||
92 | ELSE() | ||
93 | MESSAGE(FATAL_ERROR "This should never happen") | ||
94 | ENDIF() | ||
95 | |||
96 | # Use the include path to help find the library if possible | ||
97 | SET(_Threads_lib_paths "") | ||
98 | IF(THREADS_PTHREADS_INCLUDE_DIR) | ||
99 | GET_FILENAME_COMPONENT(_Threads_root_dir | ||
100 | ${THREADS_PTHREADS_INCLUDE_DIR} PATH) | ||
101 | SET(_Threads_lib_paths ${_Threads_root_dir}/lib) | ||
102 | ENDIF() | ||
103 | FIND_LIBRARY(THREADS_PTHREADS_WIN32_LIBRARY | ||
104 | NAMES ${_Threads_pthreads_libname} | ||
105 | PATHS ${_Threads_lib_paths} | ||
106 | DOC "The Portable Threads Library for Win32" | ||
107 | NO_SYSTEM_PATH | ||
108 | ) | ||
109 | |||
110 | IF(THREADS_PTHREADS_INCLUDE_DIR AND THREADS_PTHREADS_WIN32_LIBRARY) | ||
111 | MARK_AS_ADVANCED(THREADS_PTHREADS_INCLUDE_DIR) | ||
112 | SET(CMAKE_THREAD_LIBS_INIT ${THREADS_PTHREADS_WIN32_LIBRARY}) | ||
113 | SET(CMAKE_HAVE_THREADS_LIBRARY 1) | ||
114 | SET(Threads_FOUND TRUE) | ||
115 | ENDIF() | ||
116 | |||
117 | MARK_AS_ADVANCED(THREADS_PTHREADS_WIN32_LIBRARY) | ||
118 | |||
119 | ELSE() | ||
120 | # Do we have pthreads? | ||
121 | CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H) | ||
122 | IF(CMAKE_HAVE_PTHREAD_H) | ||
123 | |||
124 | # | ||
125 | # We have pthread.h | ||
126 | # Let's check for the library now. | ||
127 | # | ||
128 | SET(CMAKE_HAVE_THREADS_LIBRARY) | ||
129 | IF(NOT THREADS_HAVE_PTHREAD_ARG) | ||
130 | |||
131 | # Do we have -lpthreads | ||
132 | CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) | ||
133 | IF(CMAKE_HAVE_PTHREADS_CREATE) | ||
134 | SET(CMAKE_THREAD_LIBS_INIT "-lpthreads") | ||
135 | SET(CMAKE_HAVE_THREADS_LIBRARY 1) | ||
136 | SET(Threads_FOUND TRUE) | ||
137 | ENDIF() | ||
138 | |||
139 | # Ok, how about -lpthread | ||
140 | CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) | ||
141 | IF(CMAKE_HAVE_PTHREAD_CREATE) | ||
142 | SET(CMAKE_THREAD_LIBS_INIT "-lpthread") | ||
143 | SET(Threads_FOUND TRUE) | ||
144 | SET(CMAKE_HAVE_THREADS_LIBRARY 1) | ||
145 | ENDIF() | ||
146 | |||
147 | IF(CMAKE_SYSTEM MATCHES "SunOS.*") | ||
148 | # On sun also check for -lthread | ||
149 | CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) | ||
150 | IF(CMAKE_HAVE_THR_CREATE) | ||
151 | SET(CMAKE_THREAD_LIBS_INIT "-lthread") | ||
152 | SET(CMAKE_HAVE_THREADS_LIBRARY 1) | ||
153 | SET(Threads_FOUND TRUE) | ||
154 | ENDIF() | ||
155 | ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") | ||
156 | |||
157 | ENDIF(NOT THREADS_HAVE_PTHREAD_ARG) | ||
158 | |||
159 | IF(NOT CMAKE_HAVE_THREADS_LIBRARY) | ||
160 | # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread | ||
161 | IF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") | ||
162 | MESSAGE(STATUS "Check if compiler accepts -pthread") | ||
163 | TRY_RUN(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG | ||
164 | ${CMAKE_BINARY_DIR} | ||
165 | ${CMAKE_ROOT}/Modules/CheckForPthreads.c | ||
166 | CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread | ||
167 | COMPILE_OUTPUT_VARIABLE OUTPUT) | ||
168 | |||
169 | IF(THREADS_HAVE_PTHREAD_ARG) | ||
170 | IF(THREADS_PTHREAD_ARG MATCHES "^2$") | ||
171 | SET(Threads_FOUND TRUE) | ||
172 | MESSAGE(STATUS "Check if compiler accepts -pthread - yes") | ||
173 | ELSE() | ||
174 | MESSAGE(STATUS "Check if compiler accepts -pthread - no") | ||
175 | FILE(APPEND | ||
176 | ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log | ||
177 | "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n") | ||
178 | ENDIF() | ||
179 | ELSE() | ||
180 | MESSAGE(STATUS "Check if compiler accepts -pthread - no") | ||
181 | FILE(APPEND | ||
182 | ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log | ||
183 | "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n") | ||
184 | ENDIF() | ||
185 | |||
186 | ENDIF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG") | ||
187 | |||
188 | IF(THREADS_HAVE_PTHREAD_ARG) | ||
189 | SET(Threads_FOUND TRUE) | ||
190 | SET(CMAKE_THREAD_LIBS_INIT "-pthread") | ||
191 | ENDIF() | ||
192 | |||
193 | ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY) | ||
194 | ENDIF(CMAKE_HAVE_PTHREAD_H) | ||
195 | ENDIF() | ||
196 | |||
197 | IF(CMAKE_THREAD_LIBS_INIT) | ||
198 | SET(CMAKE_USE_PTHREADS_INIT 1) | ||
199 | SET(Threads_FOUND TRUE) | ||
200 | ENDIF() | ||
201 | |||
202 | IF(CMAKE_SYSTEM MATCHES "Windows" | ||
203 | AND NOT THREADS_USE_PTHREADS_WIN32) | ||
204 | SET(CMAKE_USE_WIN32_THREADS_INIT 1) | ||
205 | SET(Threads_FOUND TRUE) | ||
206 | ENDIF() | ||
207 | |||
208 | IF(CMAKE_USE_PTHREADS_INIT) | ||
209 | IF(CMAKE_SYSTEM MATCHES "HP-UX-*") | ||
210 | # Use libcma if it exists and can be used. It provides more | ||
211 | # symbols than the plain pthread library. CMA threads | ||
212 | # have actually been deprecated: | ||
213 | # http://docs.hp.com/en/B3920-90091/ch12s03.html#d0e11395 | ||
214 | # http://docs.hp.com/en/947/d8.html | ||
215 | # but we need to maintain compatibility here. | ||
216 | # The CMAKE_HP_PTHREADS setting actually indicates whether CMA threads | ||
217 | # are available. | ||
218 | CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA) | ||
219 | IF(CMAKE_HAVE_HP_CMA) | ||
220 | SET(CMAKE_THREAD_LIBS_INIT "-lcma") | ||
221 | SET(CMAKE_HP_PTHREADS_INIT 1) | ||
222 | SET(Threads_FOUND TRUE) | ||
223 | ENDIF(CMAKE_HAVE_HP_CMA) | ||
224 | SET(CMAKE_USE_PTHREADS_INIT 1) | ||
225 | ENDIF() | ||
226 | |||
227 | IF(CMAKE_SYSTEM MATCHES "OSF1-V*") | ||
228 | SET(CMAKE_USE_PTHREADS_INIT 0) | ||
229 | SET(CMAKE_THREAD_LIBS_INIT ) | ||
230 | ENDIF() | ||
231 | |||
232 | IF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*") | ||
233 | SET(CMAKE_USE_PTHREADS_INIT 1) | ||
234 | SET(Threads_FOUND TRUE) | ||
235 | SET(CMAKE_THREAD_LIBS_INIT ) | ||
236 | SET(CMAKE_USE_WIN32_THREADS_INIT 0) | ||
237 | ENDIF() | ||
238 | ENDIF(CMAKE_USE_PTHREADS_INIT) | ||
239 | |||
240 | INCLUDE(FindPackageHandleStandardArgs) | ||
241 | IF(_Threads_ptwin32) | ||
242 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG | ||
243 | THREADS_PTHREADS_WIN32_LIBRARY THREADS_PTHREADS_INCLUDE_DIR) | ||
244 | ELSE() | ||
245 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND) | ||
246 | ENDIF() | ||
247 | |||
248 | if(THREADS_FOUND AND NOT TARGET Threads::Threads) | ||
249 | add_library(Threads::Threads INTERFACE IMPORTED) | ||
250 | |||
251 | if(CMAKE_THREAD_LIBS_INIT) | ||
252 | set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") | ||
253 | set_property(TARGET Threads::Threads PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${THREADS_PTHREADS_INCLUDE_DIR}") | ||
254 | endif() | ||
255 | endif() \ No newline at end of file | ||
diff --git a/cmake/Findsodium.cmake b/cmake/Findsodium.cmake deleted file mode 100644 index 30e6f5c1..00000000 --- a/cmake/Findsodium.cmake +++ /dev/null | |||
@@ -1,288 +0,0 @@ | |||
1 | # Written in 2016 by Henrik Steffen Gaßmann <henrik@gassmann.onl> | ||
2 | # | ||
3 | # To the extent possible under law, the author(s) have dedicated all | ||
4 | # copyright and related and neighboring rights to this software to the | ||
5 | # public domain worldwide. This software is distributed without any warranty. | ||
6 | # | ||
7 | # You should have received a copy of the CC0 Public Domain Dedication | ||
8 | # along with this software. If not, see | ||
9 | # | ||
10 | # http://creativecommons.org/publicdomain/zero/1.0/ | ||
11 | # | ||
12 | ######################################################################## | ||
13 | # Tries to find the local libsodium installation. | ||
14 | # | ||
15 | # On Windows the sodium_DIR environment variable is used as a default | ||
16 | # hint which can be overridden by setting the corresponding cmake variable. | ||
17 | # | ||
18 | # Once done the following variables will be defined: | ||
19 | # | ||
20 | # sodium_FOUND | ||
21 | # sodium_INCLUDE_DIR | ||
22 | # sodium_LIBRARY_DEBUG | ||
23 | # sodium_LIBRARY_RELEASE | ||
24 | # | ||
25 | # | ||
26 | # Furthermore an imported "sodium" target is created. | ||
27 | # | ||
28 | |||
29 | if (CMAKE_C_COMPILER_ID STREQUAL "GNU" | ||
30 | OR CMAKE_C_COMPILER_ID STREQUAL "Clang") | ||
31 | set(_GCC_COMPATIBLE 1) | ||
32 | endif() | ||
33 | |||
34 | # static library option | ||
35 | if (NOT DEFINED sodium_USE_STATIC_LIBS) | ||
36 | option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF) | ||
37 | endif() | ||
38 | if(NOT (sodium_USE_STATIC_LIBS EQUAL sodium_USE_STATIC_LIBS_LAST)) | ||
39 | unset(sodium_LIBRARY CACHE) | ||
40 | unset(sodium_LIBRARY_DEBUG CACHE) | ||
41 | unset(sodium_LIBRARY_RELEASE CACHE) | ||
42 | unset(sodium_DLL_DEBUG CACHE) | ||
43 | unset(sodium_DLL_RELEASE CACHE) | ||
44 | set(sodium_USE_STATIC_LIBS_LAST ${sodium_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable") | ||
45 | endif() | ||
46 | |||
47 | |||
48 | ######################################################################## | ||
49 | # UNIX | ||
50 | if (UNIX) | ||
51 | # import pkg-config | ||
52 | find_package(PkgConfig QUIET) | ||
53 | if (PKG_CONFIG_FOUND) | ||
54 | pkg_check_modules(sodium_PKG QUIET libsodium) | ||
55 | endif() | ||
56 | |||
57 | if(sodium_USE_STATIC_LIBS) | ||
58 | foreach(_libname ${sodium_PKG_STATIC_LIBRARIES}) | ||
59 | if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a | ||
60 | list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a") | ||
61 | endif() | ||
62 | endforeach() | ||
63 | list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES) | ||
64 | |||
65 | # if pkgconfig for libsodium doesn't provide | ||
66 | # static lib info, then override PKG_STATIC here.. | ||
67 | if (sodium_PKG_STATIC_LIBRARIES STREQUAL "") | ||
68 | set(sodium_PKG_STATIC_LIBRARIES libsodium.a) | ||
69 | endif() | ||
70 | |||
71 | set(XPREFIX sodium_PKG_STATIC) | ||
72 | else() | ||
73 | if (sodium_PKG_LIBRARIES STREQUAL "") | ||
74 | set(sodium_PKG_LIBRARIES sodium) | ||
75 | endif() | ||
76 | |||
77 | set(XPREFIX sodium_PKG) | ||
78 | endif() | ||
79 | |||
80 | find_path(sodium_INCLUDE_DIR sodium.h | ||
81 | HINTS ${${XPREFIX}_INCLUDE_DIRS} | ||
82 | ) | ||
83 | find_library(sodium_LIBRARY_DEBUG NAMES ${${XPREFIX}_LIBRARIES} | ||
84 | HINTS ${${XPREFIX}_LIBRARY_DIRS} | ||
85 | ) | ||
86 | find_library(sodium_LIBRARY_RELEASE NAMES ${${XPREFIX}_LIBRARIES} | ||
87 | HINTS ${${XPREFIX}_LIBRARY_DIRS} | ||
88 | ) | ||
89 | |||
90 | |||
91 | ######################################################################## | ||
92 | # Windows | ||
93 | elseif (WIN32) | ||
94 | set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory") | ||
95 | mark_as_advanced(sodium_DIR) | ||
96 | |||
97 | find_path(sodium_INCLUDE_DIR sodium.h | ||
98 | HINTS ${sodium_DIR} | ||
99 | PATH_SUFFIXES include | ||
100 | ) | ||
101 | |||
102 | if (MSVC) | ||
103 | # detect target architecture | ||
104 | file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.c" [=[ | ||
105 | #if defined _M_IX86 | ||
106 | #error ARCH_VALUE x86_32 | ||
107 | #elif defined _M_X64 | ||
108 | #error ARCH_VALUE x86_64 | ||
109 | #endif | ||
110 | #error ARCH_VALUE unknown | ||
111 | ]=]) | ||
112 | try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/arch.c" | ||
113 | OUTPUT_VARIABLE _COMPILATION_LOG | ||
114 | ) | ||
115 | string(REGEX REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*" "\\1" _TARGET_ARCH "${_COMPILATION_LOG}") | ||
116 | |||
117 | # construct library path | ||
118 | if (_TARGET_ARCH STREQUAL "x86_32") | ||
119 | string(APPEND _PLATFORM_PATH "Win32") | ||
120 | elseif(_TARGET_ARCH STREQUAL "x86_64") | ||
121 | string(APPEND _PLATFORM_PATH "x64") | ||
122 | else() | ||
123 | message(FATAL_ERROR "the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake.") | ||
124 | endif() | ||
125 | string(APPEND _PLATFORM_PATH "/$$CONFIG$$") | ||
126 | |||
127 | if (MSVC_VERSION LESS 1900) | ||
128 | math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60") | ||
129 | else() | ||
130 | math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50") | ||
131 | endif() | ||
132 | string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}") | ||
133 | |||
134 | if (sodium_USE_STATIC_LIBS) | ||
135 | string(APPEND _PLATFORM_PATH "/static") | ||
136 | else() | ||
137 | string(APPEND _PLATFORM_PATH "/dynamic") | ||
138 | endif() | ||
139 | |||
140 | string(REPLACE "$$CONFIG$$" "Debug" _DEBUG_PATH_SUFFIX "${_PLATFORM_PATH}") | ||
141 | string(REPLACE "$$CONFIG$$" "Release" _RELEASE_PATH_SUFFIX "${_PLATFORM_PATH}") | ||
142 | |||
143 | find_library(sodium_LIBRARY_DEBUG libsodium.lib | ||
144 | HINTS ${sodium_DIR} | ||
145 | PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} | ||
146 | ) | ||
147 | find_library(sodium_LIBRARY_RELEASE libsodium.lib | ||
148 | HINTS ${sodium_DIR} | ||
149 | PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} | ||
150 | ) | ||
151 | if (NOT sodium_USE_STATIC_LIBS) | ||
152 | set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES}) | ||
153 | set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") | ||
154 | find_library(sodium_DLL_DEBUG libsodium | ||
155 | HINTS ${sodium_DIR} | ||
156 | PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} | ||
157 | ) | ||
158 | find_library(sodium_DLL_RELEASE libsodium | ||
159 | HINTS ${sodium_DIR} | ||
160 | PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} | ||
161 | ) | ||
162 | set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK}) | ||
163 | endif() | ||
164 | |||
165 | elseif(_GCC_COMPATIBLE) | ||
166 | if (sodium_USE_STATIC_LIBS) | ||
167 | find_library(sodium_LIBRARY_DEBUG libsodium.a | ||
168 | HINTS ${sodium_DIR} | ||
169 | PATH_SUFFIXES lib | ||
170 | ) | ||
171 | find_library(sodium_LIBRARY_RELEASE libsodium.a | ||
172 | HINTS ${sodium_DIR} | ||
173 | PATH_SUFFIXES lib | ||
174 | ) | ||
175 | else() | ||
176 | find_library(sodium_LIBRARY_DEBUG libsodium.dll.a | ||
177 | HINTS ${sodium_DIR} | ||
178 | PATH_SUFFIXES lib | ||
179 | ) | ||
180 | find_library(sodium_LIBRARY_RELEASE libsodium.dll.a | ||
181 | HINTS ${sodium_DIR} | ||
182 | PATH_SUFFIXES lib | ||
183 | ) | ||
184 | |||
185 | file(GLOB _DLL | ||
186 | LIST_DIRECTORIES false | ||
187 | RELATIVE "${sodium_DIR}/bin" | ||
188 | "${sodium_DIR}/bin/libsodium*.dll" | ||
189 | ) | ||
190 | find_library(sodium_DLL_DEBUG ${_DLL} libsodium | ||
191 | HINTS ${sodium_DIR} | ||
192 | PATH_SUFFIXES bin | ||
193 | ) | ||
194 | find_library(sodium_DLL_RELEASE ${_DLL} libsodium | ||
195 | HINTS ${sodium_DIR} | ||
196 | PATH_SUFFIXES bin | ||
197 | ) | ||
198 | endif() | ||
199 | else() | ||
200 | message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") | ||
201 | endif() | ||
202 | |||
203 | |||
204 | ######################################################################## | ||
205 | # unsupported | ||
206 | else() | ||
207 | message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") | ||
208 | endif() | ||
209 | |||
210 | |||
211 | ######################################################################## | ||
212 | # common stuff | ||
213 | |||
214 | # extract sodium version | ||
215 | if (sodium_INCLUDE_DIR) | ||
216 | set(_VERSION_HEADER "${_INCLUDE_DIR}/sodium/version.h") | ||
217 | if (EXISTS _VERSION_HEADER) | ||
218 | file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT) | ||
219 | string(REGEX REPLACE ".*#[ \t]*define[ \t]*SODIUM_VERSION_STRING[ \t]*\"([^\n]*)\".*" "\\1" | ||
220 | sodium_VERSION "${_VERSION_HEADER_CONTENT}") | ||
221 | set(sodium_VERSION "${sodium_VERSION}" PARENT_SCOPE) | ||
222 | endif() | ||
223 | endif() | ||
224 | |||
225 | # communicate results | ||
226 | include(FindPackageHandleStandardArgs) | ||
227 | find_package_handle_standard_args(sodium | ||
228 | REQUIRED_VARS | ||
229 | sodium_LIBRARY_RELEASE | ||
230 | sodium_LIBRARY_DEBUG | ||
231 | sodium_INCLUDE_DIR | ||
232 | VERSION_VAR | ||
233 | sodium_VERSION | ||
234 | ) | ||
235 | |||
236 | # mark file paths as advanced | ||
237 | mark_as_advanced(sodium_INCLUDE_DIR) | ||
238 | mark_as_advanced(sodium_LIBRARY_DEBUG) | ||
239 | mark_as_advanced(sodium_LIBRARY_RELEASE) | ||
240 | if (WIN32) | ||
241 | mark_as_advanced(sodium_DLL_DEBUG) | ||
242 | mark_as_advanced(sodium_DLL_RELEASE) | ||
243 | endif() | ||
244 | |||
245 | # create imported target | ||
246 | if(sodium_USE_STATIC_LIBS) | ||
247 | set(_LIB_TYPE STATIC) | ||
248 | else() | ||
249 | set(_LIB_TYPE SHARED) | ||
250 | endif() | ||
251 | add_library(sodium ${_LIB_TYPE} IMPORTED) | ||
252 | |||
253 | set_target_properties(sodium PROPERTIES | ||
254 | INTERFACE_INCLUDE_DIRECTORIES "${sodium_INCLUDE_DIR}" | ||
255 | IMPORTED_LINK_INTERFACE_LANGUAGES "C" | ||
256 | ) | ||
257 | |||
258 | if (sodium_USE_STATIC_LIBS) | ||
259 | set_target_properties(sodium PROPERTIES | ||
260 | INTERFACE_COMPILE_DEFINITIONS "SODIUM_STATIC" | ||
261 | IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}" | ||
262 | IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}" | ||
263 | ) | ||
264 | else() | ||
265 | if (UNIX) | ||
266 | set_target_properties(sodium PROPERTIES | ||
267 | IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}" | ||
268 | IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}" | ||
269 | ) | ||
270 | elseif (WIN32) | ||
271 | set_target_properties(sodium PROPERTIES | ||
272 | IMPORTED_IMPLIB "${sodium_LIBRARY_RELEASE}" | ||
273 | IMPORTED_IMPLIB_DEBUG "${sodium_LIBRARY_DEBUG}" | ||
274 | ) | ||
275 | if (NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND")) | ||
276 | set_target_properties(sodium PROPERTIES | ||
277 | IMPORTED_LOCATION_DEBUG "${sodium_DLL_DEBUG}" | ||
278 | ) | ||
279 | endif() | ||
280 | if (NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND")) | ||
281 | set_target_properties(sodium PROPERTIES | ||
282 | IMPORTED_LOCATION_RELWITHDEBINFO "${sodium_DLL_RELEASE}" | ||
283 | IMPORTED_LOCATION_MINSIZEREL "${sodium_DLL_RELEASE}" | ||
284 | IMPORTED_LOCATION_RELEASE "${sodium_DLL_RELEASE}" | ||
285 | ) | ||
286 | endif() | ||
287 | endif() | ||
288 | endif() | ||
diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake index a02fdb86..77911b1d 100644 --- a/cmake/ModulePackage.cmake +++ b/cmake/ModulePackage.cmake | |||
@@ -47,24 +47,18 @@ function(install_module lib) | |||
47 | VERSION ${SOVERSION} | 47 | VERSION ${SOVERSION} |
48 | SOVERSION ${SOVERSION_MAJOR} | 48 | SOVERSION ${SOVERSION_MAJOR} |
49 | ) | 49 | ) |
50 | install(TARGETS ${lib}_shared EXPORT ${lib}Targets | 50 | install(TARGETS ${lib}_shared |
51 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | 51 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
52 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | 52 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
53 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | 53 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
54 | endif() | 54 | endif() |
55 | if(ENABLE_STATIC) | 55 | if(ENABLE_STATIC) |
56 | install(TARGETS ${lib}_static EXPORT ${lib}Targets | 56 | install(TARGETS ${lib}_static |
57 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | 57 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
58 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | 58 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
59 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | 59 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
60 | endif() | 60 | endif() |
61 | 61 | ||
62 | install(EXPORT ${lib}Targets | ||
63 | FILE ${lib}Targets.cmake | ||
64 | NAMESPACE ${lib}:: | ||
65 | DESTINATION lib/cmake/${lib} | ||
66 | ) | ||
67 | |||
68 | string(REPLACE ";" " " ${lib}_PKGCONFIG_LIBS "${${lib}_PKGCONFIG_LIBS}") | 62 | string(REPLACE ";" " " ${lib}_PKGCONFIG_LIBS "${${lib}_PKGCONFIG_LIBS}") |
69 | string(REPLACE ";" " " ${lib}_PKGCONFIG_REQUIRES "${${lib}_PKGCONFIG_REQUIRES}") | 63 | string(REPLACE ";" " " ${lib}_PKGCONFIG_REQUIRES "${${lib}_PKGCONFIG_REQUIRES}") |
70 | 64 | ||
diff --git a/cmake/SimpleFindPackage.cmake b/cmake/SimpleFindPackage.cmake deleted file mode 100644 index 120b1a70..00000000 --- a/cmake/SimpleFindPackage.cmake +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | macro(simple_find_package pkg) | ||
2 | set(oneValueArgs PKGCFG_NAME) | ||
3 | set(multiValueArgs PATH_SUFFIXES INCLUDE_NAMES LIB_NAMES) | ||
4 | cmake_parse_arguments(arg "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
5 | find_package(PkgConfig QUIET) | ||
6 | pkg_check_modules(PC_${pkg} QUIET ${arg_PKGCFG_NAME}) | ||
7 | |||
8 | find_path(${pkg}_INCLUDE_DIR | ||
9 | NAMES ${arg_INCLUDE_NAMES} | ||
10 | HINTS ${PC_${pkg}_INCLUDE_DIRS} | ||
11 | PATH_SUFFIXES ${arg_PATH_SUFFIXES}) | ||
12 | |||
13 | find_library(${pkg}_LIBRARY | ||
14 | NAMES ${arg_LIB_NAMES} | ||
15 | HINTS ${PC_${pkg}_LIBRARY_DIRS}) | ||
16 | |||
17 | mark_as_advanced(${pkg}_LIBRARY ${pkg}_INCLUDE_DIR) | ||
18 | |||
19 | include(FindPackageHandleStandardArgs) | ||
20 | find_package_handle_standard_args(${pkg} | ||
21 | FOUND_VAR ${pkg}_FOUND | ||
22 | REQUIRED_VARS | ||
23 | ${pkg}_LIBRARY | ||
24 | ${pkg}_INCLUDE_DIR) | ||
25 | |||
26 | if (${pkg}_FOUND) | ||
27 | set(${pkg}_INCLUDE_DIRS ${${pkg}_INCLUDE_DIR}) | ||
28 | set(${pkg}_LIBRARIES ${${pkg}_LIBRARY}) | ||
29 | endif() | ||
30 | |||
31 | if (${pkg}_FOUND AND NOT TARGET ${pkg}::${pkg}) | ||
32 | add_library(${pkg}::${pkg} UNKNOWN IMPORTED) | ||
33 | set_target_properties(${pkg}::${pkg} PROPERTIES | ||
34 | IMPORTED_LOCATION "${${pkg}_LIBRARY}" | ||
35 | INTERFACE_INCLUDE_DIRECTORIES "${${pkg}_INCLUDE_DIR}") | ||
36 | endif() | ||
37 | endmacro() | ||
diff --git a/toxav/msi.c b/toxav/msi.c index f82b91ba..244225fa 100644 --- a/toxav/msi.c +++ b/toxav/msi.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <stdbool.h> | 30 | #include <stdbool.h> |
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <string.h> | 32 | #include <string.h> |
33 | #include <unistd.h> | ||
33 | 34 | ||
34 | #define MSI_MAXMSG_SIZE 256 | 35 | #define MSI_MAXMSG_SIZE 256 |
35 | 36 | ||