Further CMakeLists.txt improvements and cleanups
This commit is contained in:
parent
0d8caeca15
commit
29f8cc5669
1 changed files with 8 additions and 10 deletions
|
|
@ -14,19 +14,19 @@ target_include_directories(simple-web-server INTERFACE ${CMAKE_CURRENT_SOURCE_DI
|
|||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(simple-web-server INTERFACE ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
# TODO 2020 when Debian Jessie LTS ends:
|
||||
# Remove Boost system, thread, regex components; use Boost::<component> aliases; remove Boost target_include_directories
|
||||
if(USE_STANDALONE_ASIO)
|
||||
target_compile_definitions(simple-web-server INTERFACE USE_STANDALONE_ASIO)
|
||||
# TODO: Fix this:
|
||||
# include(CheckIncludeFileCXX)
|
||||
# CHECK_INCLUDE_FILE_CXX(asio.hpp HAVE_ASIO)
|
||||
# if(NOT HAVE_ASIO)
|
||||
# message(FATAL_ERROR "Standalone Asio not found")
|
||||
# endif()
|
||||
include(CheckIncludeFileCXX)
|
||||
CHECK_INCLUDE_FILE_CXX(asio.hpp HAVE_ASIO)
|
||||
if(NOT HAVE_ASIO)
|
||||
message(FATAL_ERROR "Standalone Asio not found")
|
||||
endif()
|
||||
else()
|
||||
find_package(Boost 1.53.0 COMPONENTS system thread REQUIRED)
|
||||
target_link_libraries(simple-web-server INTERFACE ${Boost_LIBRARIES})
|
||||
target_include_directories(simple-web-server INTERFACE ${Boost_INCLUDE_DIR})
|
||||
# 2020 TODO: remove the following checks and always use std::regex
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
||||
target_compile_definitions(simple-web-server INTERFACE USE_BOOST_REGEX)
|
||||
find_package(Boost 1.53.0 COMPONENTS regex REQUIRED)
|
||||
|
|
@ -48,15 +48,13 @@ if(OPENSSL_FOUND)
|
|||
target_include_directories(simple-web-server INTERFACE ${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# if Simple-Web-Server is not a sub-project:
|
||||
# If Simple-Web-Server is not a sub-project:
|
||||
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
add_executable(http_examples http_examples.cpp)
|
||||
target_link_libraries(http_examples simple-web-server)
|
||||
|
||||
find_package(Boost 1.53.0 COMPONENTS system filesystem REQUIRED)
|
||||
target_link_libraries(http_examples ${Boost_LIBRARIES})
|
||||
target_include_directories(http_examples PRIVATE ${Boost_INCLUDE_DIR})
|
||||
|
||||
if(OPENSSL_FOUND)
|
||||
add_executable(https_examples https_examples.cpp)
|
||||
target_link_libraries(https_examples simple-web-server)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue