From 3c251dfadba8e19bd563563fee1c574a143bb530 Mon Sep 17 00:00:00 2001 From: David Wedderwille Date: Tue, 13 Aug 2019 13:44:23 +0200 Subject: [PATCH] create the examples only ( http_examples.cpp / https_examples.cpp ) if the boost library is found. --- CMakeLists.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca7b1cd..73521ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,19 +61,19 @@ endif() # 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 thread 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) - target_link_libraries(https_examples ${Boost_LIBRARIES}) - target_include_directories(https_examples PRIVATE ${Boost_INCLUDE_DIR}) - endif() - + find_package(Boost 1.53.0 COMPONENTS system thread filesystem) + if(Boost_FOUND) + add_executable(http_examples http_examples.cpp) + target_link_libraries(http_examples simple-web-server) + 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) + target_link_libraries(https_examples ${Boost_LIBRARIES}) + target_include_directories(https_examples PRIVATE ${Boost_INCLUDE_DIR}) + endif() + endif() set(BUILD_TESTING ON) install(FILES asio_compatibility.hpp server_http.hpp client_http.hpp server_https.hpp client_https.hpp crypto.hpp utility.hpp status_code.hpp mutex.hpp DESTINATION include/simple-web-server)