Use Boost::* CMake targets
This commit is contained in:
parent
0ec5a11473
commit
a8b7dab938
1 changed files with 4 additions and 10 deletions
|
|
@ -18,8 +18,6 @@ target_include_directories(simple-web-server INTERFACE ${CMAKE_CURRENT_SOURCE_DI
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(simple-web-server INTERFACE Threads::Threads)
|
target_link_libraries(simple-web-server INTERFACE Threads::Threads)
|
||||||
|
|
||||||
# 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)
|
if(USE_STANDALONE_ASIO)
|
||||||
target_compile_definitions(simple-web-server INTERFACE ASIO_STANDALONE)
|
target_compile_definitions(simple-web-server INTERFACE ASIO_STANDALONE)
|
||||||
find_path(ASIO_PATH asio.hpp)
|
find_path(ASIO_PATH asio.hpp)
|
||||||
|
|
@ -30,13 +28,11 @@ if(USE_STANDALONE_ASIO)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
find_package(Boost 1.53.0 COMPONENTS system thread REQUIRED)
|
find_package(Boost 1.53.0 COMPONENTS system thread REQUIRED)
|
||||||
target_link_libraries(simple-web-server INTERFACE ${Boost_LIBRARIES})
|
target_link_libraries(simple-web-server INTERFACE Boost::boost Boost::system Boost::thread)
|
||||||
target_include_directories(simple-web-server INTERFACE ${Boost_INCLUDE_DIR})
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
|
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)
|
target_compile_definitions(simple-web-server INTERFACE USE_BOOST_REGEX)
|
||||||
find_package(Boost 1.53.0 COMPONENTS regex REQUIRED)
|
find_package(Boost 1.53.0 COMPONENTS regex REQUIRED)
|
||||||
target_link_libraries(simple-web-server INTERFACE ${Boost_LIBRARIES})
|
target_link_libraries(simple-web-server INTERFACE Boost::regex)
|
||||||
target_include_directories(simple-web-server INTERFACE ${Boost_INCLUDE_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|
@ -74,13 +70,11 @@ if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
if(Boost_FOUND)
|
if(Boost_FOUND)
|
||||||
add_executable(http_examples http_examples.cpp)
|
add_executable(http_examples http_examples.cpp)
|
||||||
target_link_libraries(http_examples simple-web-server)
|
target_link_libraries(http_examples simple-web-server)
|
||||||
target_link_libraries(http_examples ${Boost_LIBRARIES})
|
target_link_libraries(http_examples Boost::boost Boost::system Boost::thread Boost::filesystem)
|
||||||
target_include_directories(http_examples PRIVATE ${Boost_INCLUDE_DIR})
|
|
||||||
if(OPENSSL_FOUND)
|
if(OPENSSL_FOUND)
|
||||||
add_executable(https_examples https_examples.cpp)
|
add_executable(https_examples https_examples.cpp)
|
||||||
target_link_libraries(https_examples simple-web-server)
|
target_link_libraries(https_examples simple-web-server)
|
||||||
target_link_libraries(https_examples ${Boost_LIBRARIES})
|
target_link_libraries(https_examples Boost::boost Boost::system Boost::thread Boost::filesystem)
|
||||||
target_include_directories(https_examples PRIVATE ${Boost_INCLUDE_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue