Use correct libraries when compiling statically (#2136)
When compiling statically, cmake pulls shared libraries as dependencies for drogon e.g. libpq.so instead of libpq.a. This causes linkage errors when compiling the whole program. The flag USE_STATIC_LIBS_ONLY should set the CMAKE_FIND_LIBRARY_SUFFIXES to the appropriate suffix on different platforms, thus find_* commands find the right library.
This commit is contained in:
parent
5b5d1906bf
commit
80ec7d9211
|
@ -13,6 +13,7 @@ option(BUILD_DOC "Build Doxygen documentation" OFF)
|
|||
option(BUILD_BROTLI "Build Brotli" ON)
|
||||
option(BUILD_YAML_CONFIG "Build yaml config" ON)
|
||||
option(USE_SUBMODULE "Use trantor as a submodule" ON)
|
||||
option(USE_STATIC_LIBS_ONLY "Use only static libraries as dependencies" OFF)
|
||||
|
||||
include(CMakeDependentOption)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_POSTGRESQL "Build with postgresql support" ON "BUILD_ORM" OFF)
|
||||
|
@ -77,6 +78,10 @@ if (BUILD_SHARED_LIBS)
|
|||
endif ()
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
|
||||
if(USE_STATIC_LIBS_ONLY)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif(USE_STATIC_LIBS_ONLY)
|
||||
|
||||
if(USE_SPDLOG)
|
||||
find_package(spdlog CONFIG)
|
||||
if(spdlog_FOUND)
|
||||
|
|
Loading…
Reference in New Issue