diff options
author | kinichiro <kinichiro.inoguchi@gmail.com> | 2018-10-03 20:35:36 +0900 |
---|---|---|
committer | kinichiro <kinichiro.inoguchi@gmail.com> | 2018-10-03 20:35:36 +0900 |
commit | f819a2bce7a708147df16b5bef21ccaadf7b9913 (patch) | |
tree | da7b7edf6464cf6392f44c0c47c214e1b5f88313 /CMakeLists.txt | |
parent | 8bce9f9da4f28cff658f55f2c5c3c620bc13785c (diff) | |
download | portable-f819a2bce7a708147df16b5bef21ccaadf7b9913.tar.gz portable-f819a2bce7a708147df16b5bef21ccaadf7b9913.tar.bz2 portable-f819a2bce7a708147df16b5bef21ccaadf7b9913.zip |
Fix cmake linking libraries
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 549849f..27cd8da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -55,6 +55,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux") | |||
55 | add_definitions(-D_BSD_SOURCE) | 55 | add_definitions(-D_BSD_SOURCE) |
56 | add_definitions(-D_POSIX_SOURCE) | 56 | add_definitions(-D_POSIX_SOURCE) |
57 | add_definitions(-D_GNU_SOURCE) | 57 | add_definitions(-D_GNU_SOURCE) |
58 | set(PLATFORM_LDADD ${PLATFORM_LDADD} pthread) | ||
58 | endif() | 59 | endif() |
59 | 60 | ||
60 | if(CMAKE_SYSTEM_NAME MATCHES "MINGW") | 61 | if(CMAKE_SYSTEM_NAME MATCHES "MINGW") |
@@ -73,6 +74,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "HP-UX") | |||
73 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 +DD64 +Otype_safety=off") | 74 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 +DD64 +Otype_safety=off") |
74 | endif() | 75 | endif() |
75 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT") | 76 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT") |
77 | set(PLATFORM_LDADD ${PLATFORM_LDADD} pthread) | ||
76 | endif() | 78 | endif() |
77 | 79 | ||
78 | if(CMAKE_SYSTEM_NAME MATCHES "SunOS") | 80 | if(CMAKE_SYSTEM_NAME MATCHES "SunOS") |
@@ -81,6 +83,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS") | |||
81 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600") | 83 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600") |
82 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBSD_COMP") | 84 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBSD_COMP") |
83 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic") | 85 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic") |
86 | set(PLATFORM_LDADD ${PLATFORM_LDADD} nsl socket) | ||
84 | endif() | 87 | endif() |
85 | 88 | ||
86 | add_definitions(-DLIBRESSL_INTERNAL) | 89 | add_definitions(-DLIBRESSL_INTERNAL) |
@@ -101,6 +104,7 @@ if(WIN32) | |||
101 | add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS) | 104 | add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS) |
102 | add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600) | 105 | add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600) |
103 | add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT) | 106 | add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT) |
107 | set(PLATFORM_LDADD ${PLATFORM_LDADD} ws2_32) | ||
104 | endif() | 108 | endif() |
105 | 109 | ||
106 | if(MSVC) | 110 | if(MSVC) |
@@ -262,27 +266,11 @@ if(ENABLE_ASM) | |||
262 | endif() | 266 | endif() |
263 | endif() | 267 | endif() |
264 | 268 | ||
265 | set(OPENSSL_LIBS tls ssl crypto) | ||
266 | |||
267 | # Add additional required libs | ||
268 | if(WIN32) | ||
269 | set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32) | ||
270 | endif() | ||
271 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
272 | set(OPENSSL_LIBS ${OPENSSL_LIBS} pthread) | ||
273 | endif() | ||
274 | if(CMAKE_SYSTEM_NAME MATCHES "HP-UX") | ||
275 | set(OPENSSL_LIBS ${OPENSSL_LIBS} pthread) | ||
276 | endif() | ||
277 | if(CMAKE_SYSTEM_NAME MATCHES "SunOS") | ||
278 | set(OPENSSL_LIBS ${OPENSSL_LIBS} nsl socket) | ||
279 | endif() | ||
280 | |||
281 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") | 269 | if(CMAKE_SYSTEM_NAME MATCHES "Linux") |
282 | # Check if we need -lrt to get clock_gettime on Linux | 270 | # Check if we need -lrt to get clock_gettime on Linux |
283 | check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) | 271 | check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) |
284 | if (HAVE_CLOCK_GETTIME) | 272 | if (HAVE_CLOCK_GETTIME) |
285 | set(OPENSSL_LIBS ${OPENSSL_LIBS} rt) | 273 | set(PLATFORM_LDADD ${PLATFORM_LDADD} rt) |
286 | endif() | 274 | endif() |
287 | else() | 275 | else() |
288 | # Otherwise, simply check if it exists | 276 | # Otherwise, simply check if it exists |
@@ -301,6 +289,8 @@ if(SIZEOF_TIME_T STREQUAL "4") | |||
301 | endif() | 289 | endif() |
302 | add_definitions(-DSIZEOF_TIME_T=${SIZEOF_TIME_T}) | 290 | add_definitions(-DSIZEOF_TIME_T=${SIZEOF_TIME_T}) |
303 | 291 | ||
292 | set(OPENSSL_LIBS tls ssl crypto ${PLATFORM_LDADD}) | ||
293 | |||
304 | add_subdirectory(crypto) | 294 | add_subdirectory(crypto) |
305 | add_subdirectory(ssl) | 295 | add_subdirectory(ssl) |
306 | if(LIBRESSL_APPS) | 296 | if(LIBRESSL_APPS) |