cmake: Include OpenSSL libraries in static linking
This commit is contained in:
parent
c2f2437586
commit
9832d18dca
|
@ -177,8 +177,6 @@ if(MINGW)
|
||||||
list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES ${DEFLIB})
|
list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES ${DEFLIB})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
|
||||||
|
|
||||||
if(STATIC)
|
if(STATIC)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
|
|
@ -76,11 +76,12 @@ endif()
|
||||||
find_package(Unbound)
|
find_package(Unbound)
|
||||||
|
|
||||||
if(NOT UNBOUND_INCLUDE_DIR OR STATIC)
|
if(NOT UNBOUND_INCLUDE_DIR OR STATIC)
|
||||||
# We want unbound config tests to be independent of changes made to this setting.
|
# NOTE: If STATIC is true, CMAKE_FIND_LIBRARY_SUFFIXES has been reordered.
|
||||||
set(CURRENT_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
# unbound has config tests which used OpenSSL libraries, so -ldl may need to
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
# be set in this case.
|
||||||
|
# The unbound CMakeLists.txt can set it, since it's also needed for the
|
||||||
|
# static OpenSSL libraries set up there after with target_link_libraries.
|
||||||
add_subdirectory(unbound)
|
add_subdirectory(unbound)
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CURRENT_CMAKE_FIND_LIBRARY_SUFFIXES})
|
|
||||||
|
|
||||||
set(UNBOUND_STATIC true PARENT_SCOPE)
|
set(UNBOUND_STATIC true PARENT_SCOPE)
|
||||||
set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE)
|
set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE)
|
||||||
|
|
|
@ -40,6 +40,12 @@ if (APPLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
|
if(STATIC)
|
||||||
|
if(UNIX)
|
||||||
|
set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
include(configure_checks.cmake)
|
include(configure_checks.cmake)
|
||||||
|
|
Loading…
Reference in New Issue