Fix cmake linking libraries
This commit is contained in:
parent
8bce9f9da4
commit
f819a2bce7
@ -55,6 +55,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||||||
add_definitions(-D_BSD_SOURCE)
|
add_definitions(-D_BSD_SOURCE)
|
||||||
add_definitions(-D_POSIX_SOURCE)
|
add_definitions(-D_POSIX_SOURCE)
|
||||||
add_definitions(-D_GNU_SOURCE)
|
add_definitions(-D_GNU_SOURCE)
|
||||||
|
set(PLATFORM_LDADD ${PLATFORM_LDADD} pthread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "MINGW")
|
if(CMAKE_SYSTEM_NAME MATCHES "MINGW")
|
||||||
@ -73,6 +74,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
|
|||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 +DD64 +Otype_safety=off")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 +DD64 +Otype_safety=off")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT")
|
||||||
|
set(PLATFORM_LDADD ${PLATFORM_LDADD} pthread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||||
@ -81,6 +83,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
|||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=600")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBSD_COMP")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBSD_COMP")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic")
|
||||||
|
set(PLATFORM_LDADD ${PLATFORM_LDADD} nsl socket)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(-DLIBRESSL_INTERNAL)
|
add_definitions(-DLIBRESSL_INTERNAL)
|
||||||
@ -101,6 +104,7 @@ if(WIN32)
|
|||||||
add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS)
|
add_definitions(-D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS)
|
||||||
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600)
|
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600)
|
||||||
add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT)
|
add_definitions(-DCPPFLAGS -DOPENSSL_NO_SPEED -DNO_SYSLOG -DNO_CRYPT)
|
||||||
|
set(PLATFORM_LDADD ${PLATFORM_LDADD} ws2_32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
@ -262,27 +266,11 @@ if(ENABLE_ASM)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(OPENSSL_LIBS tls ssl crypto)
|
|
||||||
|
|
||||||
# Add additional required libs
|
|
||||||
if(WIN32)
|
|
||||||
set(OPENSSL_LIBS ${OPENSSL_LIBS} ws2_32)
|
|
||||||
endif()
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
||||||
set(OPENSSL_LIBS ${OPENSSL_LIBS} pthread)
|
|
||||||
endif()
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
|
|
||||||
set(OPENSSL_LIBS ${OPENSSL_LIBS} pthread)
|
|
||||||
endif()
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
|
||||||
set(OPENSSL_LIBS ${OPENSSL_LIBS} nsl socket)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
# Check if we need -lrt to get clock_gettime on Linux
|
# Check if we need -lrt to get clock_gettime on Linux
|
||||||
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
||||||
if (HAVE_CLOCK_GETTIME)
|
if (HAVE_CLOCK_GETTIME)
|
||||||
set(OPENSSL_LIBS ${OPENSSL_LIBS} rt)
|
set(PLATFORM_LDADD ${PLATFORM_LDADD} rt)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# Otherwise, simply check if it exists
|
# Otherwise, simply check if it exists
|
||||||
@ -301,6 +289,8 @@ if(SIZEOF_TIME_T STREQUAL "4")
|
|||||||
endif()
|
endif()
|
||||||
add_definitions(-DSIZEOF_TIME_T=${SIZEOF_TIME_T})
|
add_definitions(-DSIZEOF_TIME_T=${SIZEOF_TIME_T})
|
||||||
|
|
||||||
|
set(OPENSSL_LIBS tls ssl crypto ${PLATFORM_LDADD})
|
||||||
|
|
||||||
add_subdirectory(crypto)
|
add_subdirectory(crypto)
|
||||||
add_subdirectory(ssl)
|
add_subdirectory(ssl)
|
||||||
if(LIBRESSL_APPS)
|
if(LIBRESSL_APPS)
|
||||||
|
@ -814,8 +814,8 @@ target_include_directories(crypto
|
|||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym)
|
export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym)
|
||||||
|
target_link_libraries(crypto ${PLATFORM_LDADD})
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(crypto Ws2_32.lib)
|
|
||||||
set(CRYPTO_POSTFIX -${CRYPTO_MAJOR_VERSION})
|
set(CRYPTO_POSTFIX -${CRYPTO_MAJOR_VERSION})
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(crypto PROPERTIES
|
set_target_properties(crypto PROPERTIES
|
||||||
|
@ -51,9 +51,8 @@ target_include_directories(ssl
|
|||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
export_symbol(ssl ${CMAKE_CURRENT_SOURCE_DIR}/ssl.sym)
|
export_symbol(ssl ${CMAKE_CURRENT_SOURCE_DIR}/ssl.sym)
|
||||||
target_link_libraries(ssl crypto)
|
target_link_libraries(ssl crypto ${PLATFORM_LDADD})
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(ssl Ws2_32.lib)
|
|
||||||
set(SSL_POSTFIX -${SSL_MAJOR_VERSION})
|
set(SSL_POSTFIX -${SSL_MAJOR_VERSION})
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(ssl PROPERTIES
|
set_target_properties(ssl PROPERTIES
|
||||||
|
@ -40,9 +40,8 @@ target_include_directories(tls
|
|||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
export_symbol(tls ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym)
|
export_symbol(tls ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym)
|
||||||
target_link_libraries(tls ssl crypto)
|
target_link_libraries(tls ssl crypto ${PLATFORM_LDADD})
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(tls Ws2_32.lib)
|
|
||||||
set(TLS_POSTFIX -${TLS_MAJOR_VERSION})
|
set(TLS_POSTFIX -${TLS_MAJOR_VERSION})
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(tls PROPERTIES
|
set_target_properties(tls PROPERTIES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user