diff --git a/CMakeLists.txt b/CMakeLists.txt index e601d7a1..2898f661 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,27 +47,8 @@ endif() option (Boost_USE_STATIC_LIBS "Use static libraries for boost" ON) -set (Boost_USE_MULTITHREADED ON) - -add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING=1) # for asio - -unset (Boost_INCLUDE_DIR CACHE) -unset (Boost_LIBRARY_DIRS CACHE) -if (MSVC) - find_package (Boost REQUIRED) -else() - find_package (Boost REQUIRED COMPONENTS - coroutine - context - filesystem - program_options - system - thread - ) - link_libraries (${Boost_LIBRARIES}) -endif() - -include_directories (SYSTEM ${Boost_INCLUDE_DIRS}) +set (BOOST_COMPONENTS coroutine context filesystem program_options system thread) +find_package (Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) if (MINGW) link_libraries(ws2_32 mswsock) @@ -143,7 +124,8 @@ target_link_libraries(${PROJECT_NAME} INTERFACE ${Boost_SYSTEM_LIBRARY}) if (NOT MSVC) target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads) endif() -target_include_directories(${PROJECT_NAME} INTERFACE ${Boost_INCLUDE_DIRS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}) target_compile_definitions(${PROJECT_NAME} INTERFACE BOOST_COROUTINES_NO_DEPRECATION_WARNING=1) #------------------------------------------------------------------------------- diff --git a/example/echo-op/CMakeLists.txt b/example/echo-op/CMakeLists.txt index 5d0ced78..e1a99b8b 100644 --- a/example/echo-op/CMakeLists.txt +++ b/example/echo-op/CMakeLists.txt @@ -10,8 +10,4 @@ add_executable (echo-op echo_op.cpp ) -if (NOT WIN32) - target_link_libraries(echo-op ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(echo-op ${Boost_LIBRARIES}) -endif() +target_link_libraries(echo-op Beast) diff --git a/example/http-client/CMakeLists.txt b/example/http-client/CMakeLists.txt index 0ec62123..63975a98 100644 --- a/example/http-client/CMakeLists.txt +++ b/example/http-client/CMakeLists.txt @@ -11,8 +11,4 @@ add_executable (http-client http_client.cpp ) -if (NOT WIN32) - target_link_libraries(http-client ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(http-client ${Boost_LIBRARIES}) -endif() +target_link_libraries(http-client Beast) diff --git a/example/http-crawl/CMakeLists.txt b/example/http-crawl/CMakeLists.txt index 999efe48..1a24818a 100644 --- a/example/http-crawl/CMakeLists.txt +++ b/example/http-crawl/CMakeLists.txt @@ -13,8 +13,4 @@ add_executable (http-crawl http_crawl.cpp ) -if (NOT WIN32) - target_link_libraries(http-crawl ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(http-crawl ${Boost_LIBRARIES}) -endif() +target_link_libraries(http-crawl Beast) diff --git a/example/http-server/CMakeLists.txt b/example/http-server/CMakeLists.txt index de6266e1..d3547404 100644 --- a/example/http-server/CMakeLists.txt +++ b/example/http-server/CMakeLists.txt @@ -15,8 +15,4 @@ add_executable (http-server main.cpp ) -if (NOT WIN32) - target_link_libraries(http-server ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(http-server ${Boost_LIBRARIES}) -endif() +target_link_libraries(http-server Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ) diff --git a/example/ssl/CMakeLists.txt b/example/ssl/CMakeLists.txt index 9962a9dc..44963f08 100644 --- a/example/ssl/CMakeLists.txt +++ b/example/ssl/CMakeLists.txt @@ -13,11 +13,7 @@ add_executable (http-ssl-example http_ssl_example.cpp ) -target_link_libraries(http-ssl-example ${OPENSSL_LIBRARIES}) - -if (NOT WIN32) - target_link_libraries(http-ssl-example ${Boost_LIBRARIES} Threads::Threads) -endif() +target_link_libraries(http-ssl-example Beast ${OPENSSL_LIBRARIES}) add_executable (websocket-ssl-example ${BEAST_INCLUDES} @@ -25,8 +21,4 @@ add_executable (websocket-ssl-example websocket_ssl_example.cpp ) -target_link_libraries(websocket-ssl-example ${OPENSSL_LIBRARIES}) - -if (NOT WIN32) - target_link_libraries(websocket-ssl-example ${Boost_LIBRARIES} Threads::Threads) -endif() +target_link_libraries(websocket-ssl-example Beast ${OPENSSL_LIBRARIES}) diff --git a/example/websocket-client/CMakeLists.txt b/example/websocket-client/CMakeLists.txt index e998356d..f2f3755f 100644 --- a/example/websocket-client/CMakeLists.txt +++ b/example/websocket-client/CMakeLists.txt @@ -11,9 +11,4 @@ add_executable (websocket-client websocket_client.cpp ) -if (NOT WIN32) - target_link_libraries(websocket-client ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(websocket-client ${Boost_LIBRARIES}) -endif() - +target_link_libraries(websocket-client Beast) diff --git a/example/websocket-server/CMakeLists.txt b/example/websocket-server/CMakeLists.txt index 48dc3e76..bb081d7d 100644 --- a/example/websocket-server/CMakeLists.txt +++ b/example/websocket-server/CMakeLists.txt @@ -12,8 +12,4 @@ add_executable (websocket-server websocket_sync_echo_server.hpp ) -if (NOT WIN32) - target_link_libraries(websocket-server ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(websocket-server ${Boost_LIBRARIES}) -endif() +target_link_libraries(websocket-server Beast) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ff15cb4d..0e92e3c3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,11 +16,7 @@ add_executable (lib-tests zlib.cpp ) -if (NOT WIN32) - target_link_libraries(lib-tests ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(lib-tests ${Boost_LIBRARIES}) -endif() +target_link_libraries(lib-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY}) if (MINGW) set_target_properties(lib-tests PROPERTIES COMPILE_FLAGS "-Wa,-mbig-obj") diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 7a39b036..b71d54b3 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -40,6 +40,4 @@ add_executable (core-tests sha1.cpp ) -if (NOT WIN32) - target_link_libraries(core-tests ${Boost_LIBRARIES} Threads::Threads) -endif() +target_link_libraries(core-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_COROUTINE_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY}) diff --git a/test/http/CMakeLists.txt b/test/http/CMakeLists.txt index 39bb65dd..57eeaf7c 100644 --- a/test/http/CMakeLists.txt +++ b/test/http/CMakeLists.txt @@ -35,11 +35,7 @@ add_executable (http-tests write.cpp ) -if (NOT WIN32) - target_link_libraries(http-tests ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(http-tests ${Boost_LIBRARIES}) -endif() +target_link_libraries(http-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_COROUTINE_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY}) add_executable (http-bench ${BEAST_INCLUDES} @@ -51,8 +47,4 @@ add_executable (http-bench parser_bench.cpp ) -if (NOT WIN32) - target_link_libraries(http-bench ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(http-bench ${Boost_LIBRARIES}) -endif() +target_link_libraries(http-bench Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) diff --git a/test/websocket/CMakeLists.txt b/test/websocket/CMakeLists.txt index d6c5a034..8d709eb1 100644 --- a/test/websocket/CMakeLists.txt +++ b/test/websocket/CMakeLists.txt @@ -21,11 +21,7 @@ add_executable (websocket-tests utf8_checker.cpp ) -if (NOT WIN32) - target_link_libraries(websocket-tests ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(websocket-tests ${Boost_LIBRARIES}) -endif() +target_link_libraries(websocket-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_COROUTINE_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY}) if (MINGW) set_target_properties(websocket-tests PROPERTIES COMPILE_FLAGS "-Wa,-mbig-obj -Og") diff --git a/test/websocket/ssl/CMakeLists.txt b/test/websocket/ssl/CMakeLists.txt index 4132e4c6..f6b0235e 100644 --- a/test/websocket/ssl/CMakeLists.txt +++ b/test/websocket/ssl/CMakeLists.txt @@ -16,8 +16,4 @@ add_executable (websocket-ssl-tests ssl_server.cpp ) -target_link_libraries(websocket-ssl-tests ${OPENSSL_LIBRARIES}) - -if (NOT WIN32) - target_link_libraries(websocket-ssl-tests ${Boost_LIBRARIES} Threads::Threads) -endif() +target_link_libraries(websocket-ssl-tests Beast ${OPENSSL_LIBRARIES} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) diff --git a/test/zlib/CMakeLists.txt b/test/zlib/CMakeLists.txt index 4d955e26..0d571417 100644 --- a/test/zlib/CMakeLists.txt +++ b/test/zlib/CMakeLists.txt @@ -19,8 +19,4 @@ add_executable (zlib-tests inflate_stream.cpp ) -if (NOT WIN32) - target_link_libraries(zlib-tests ${Boost_LIBRARIES} Threads::Threads) -else() - target_link_libraries(zlib-tests ${Boost_LIBRARIES}) -endif() +target_link_libraries(zlib-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})