Only link Boost libraries which are actually needed.
Asio does not require Boost. Bosot.Asio requires Boost.System and optionally Boost.Regex. The examples require Boost headers and Boost.Filesystem. The CMake targets pull in their dependencies recursively, no need to explicitly link the examples to Boost.System. Boost.Thread should not be neede, according to the docs.
This commit is contained in:
parent
fff70e5231
commit
17c1a8b65f
1 changed files with 5 additions and 7 deletions
|
|
@ -27,8 +27,8 @@ if(USE_STANDALONE_ASIO)
|
||||||
target_include_directories(simple-web-server INTERFACE ${ASIO_PATH})
|
target_include_directories(simple-web-server INTERFACE ${ASIO_PATH})
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
find_package(Boost 1.53.0 COMPONENTS system thread REQUIRED)
|
find_package(Boost 1.53.0 COMPONENTS system REQUIRED)
|
||||||
target_link_libraries(simple-web-server INTERFACE Boost::boost Boost::system Boost::thread)
|
target_link_libraries(simple-web-server INTERFACE Boost::boost Boost::system)
|
||||||
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)
|
||||||
|
|
@ -65,15 +65,13 @@ if(CMAKE_SOURCE_DIR STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
add_compile_options(/W1)
|
add_compile_options(/W1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Boost 1.53.0 COMPONENTS system thread filesystem)
|
find_package(Boost 1.53.0 COMPONENTS filesystem)
|
||||||
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 Boost::boost Boost::filesystem)
|
||||||
target_link_libraries(http_examples Boost::boost Boost::system Boost::thread Boost::filesystem)
|
|
||||||
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 Boost::boost Boost::filesystem)
|
||||||
target_link_libraries(https_examples Boost::boost Boost::system Boost::thread Boost::filesystem)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue