Add an option in CMakeLists.txt to set how to use trantor (#1520)
This commit is contained in:
parent
b739a7fab8
commit
57ec87d38d
|
@ -19,6 +19,7 @@ option(COZ_PROFILING "Use coz for profiling" OFF)
|
|||
option(BUILD_SHARED_LIBS "Build drogon as a shared lib" OFF)
|
||||
option(BUILD_DOC "Build Doxygen documentation" OFF)
|
||||
option(BUILD_BROTLI "Build Brotli" ON)
|
||||
option(USE_SUBMODULE "Use trantor as a submodule" ON)
|
||||
|
||||
include(CMakeDependentOption)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_POSTGRESQL "Build with postgresql support" ON "BUILD_ORM" OFF)
|
||||
|
@ -99,14 +100,18 @@ elseif (HAS_ANY AND HAS_STRING_VIEW)
|
|||
else ()
|
||||
set(DROGON_CXX_STANDARD 14)
|
||||
endif ()
|
||||
|
||||
if(USE_SUBMODULE)
|
||||
target_include_directories(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/trantor>)
|
||||
endif()
|
||||
target_include_directories(
|
||||
${PROJECT_NAME}
|
||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib/inc>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/orm_lib/inc>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/nosql_lib/redis/inc>
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/trantor>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/exports>
|
||||
$<INSTALL_INTERFACE:${INSTALL_INCLUDE_DIR}>)
|
||||
|
||||
|
@ -116,9 +121,13 @@ if (WIN32)
|
|||
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/mman-win32>)
|
||||
endif (WIN32)
|
||||
|
||||
if(USE_SUBMODULE)
|
||||
add_subdirectory(trantor)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC trantor)
|
||||
else()
|
||||
find_package(Trantor CONFIG REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Trantor::Trantor)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku")
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE network)
|
||||
|
|
Loading…
Reference in New Issue