mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 14:24:31 +02:00
Tidy up CMakeLists.txt
This commit is contained in:
@@ -29,10 +29,10 @@ if (MSVC)
|
||||
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO ${replacement_flags})
|
||||
|
||||
else()
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads)
|
||||
set (THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package (Threads)
|
||||
|
||||
set(CMAKE_CXX_FLAGS
|
||||
set( CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wpedantic -Wno-unused-parameter")
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
@@ -72,6 +72,7 @@ find_package(OpenSSL)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
add_definitions (-DBEAST_USE_OPENSSL=1)
|
||||
|
||||
else()
|
||||
add_definitions (-DBEAST_USE_OPENSSL=0)
|
||||
message("OpenSSL not found.")
|
||||
@@ -81,11 +82,11 @@ endif()
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
function(DoGroupSources curdir rootdir folder)
|
||||
file(GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir} ${PROJECT_SOURCE_DIR}/${curdir}/*)
|
||||
foreach(child ${children})
|
||||
if(IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
|
||||
file (GLOB children RELATIVE ${PROJECT_SOURCE_DIR}/${curdir} ${PROJECT_SOURCE_DIR}/${curdir}/*)
|
||||
foreach (child ${children})
|
||||
if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/${curdir}/${child})
|
||||
DoGroupSources(${curdir}/${child} ${rootdir} ${folder})
|
||||
elseif(${child} STREQUAL "CMakeLists.txt")
|
||||
elseif (${child} STREQUAL "CMakeLists.txt")
|
||||
source_group("" FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
|
||||
else()
|
||||
string(REGEX REPLACE ^${rootdir} ${folder} groupname ${curdir})
|
||||
@@ -96,7 +97,7 @@ function(DoGroupSources curdir rootdir folder)
|
||||
endfunction()
|
||||
|
||||
function(GroupSources curdir folder)
|
||||
DoGroupSources(${curdir} ${curdir} ${folder})
|
||||
DoGroupSources (${curdir} ${curdir} ${folder})
|
||||
endfunction()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -104,7 +105,7 @@ endfunction()
|
||||
if ("${VARIANT}" STREQUAL "coverage")
|
||||
if (MSVC)
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
|
||||
endif()
|
||||
@@ -112,17 +113,17 @@ if ("${VARIANT}" STREQUAL "coverage")
|
||||
elseif ("${VARIANT}" STREQUAL "ubasan")
|
||||
if (MSVC)
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS
|
||||
set (CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -DBEAST_NO_SLOW_TESTS=1 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist.supp")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined")
|
||||
set(CMAKE_BUILD_TYPE RELWITHDEBINFO)
|
||||
set (CMAKE_BUILD_TYPE RELWITHDEBINFO)
|
||||
endif()
|
||||
|
||||
elseif ("${VARIANT}" STREQUAL "debug")
|
||||
set(CMAKE_BUILD_TYPE DEBUG)
|
||||
set (CMAKE_BUILD_TYPE DEBUG)
|
||||
|
||||
elseif ("${VARIANT}" STREQUAL "release")
|
||||
set(CMAKE_BUILD_TYPE RELEASE)
|
||||
set (CMAKE_BUILD_TYPE RELEASE)
|
||||
|
||||
endif()
|
||||
|
||||
@@ -131,14 +132,14 @@ endif()
|
||||
# Library interface
|
||||
#
|
||||
|
||||
add_library(${PROJECT_NAME} INTERFACE)
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE ${Boost_SYSTEM_LIBRARY})
|
||||
add_library (${PROJECT_NAME} INTERFACE)
|
||||
target_link_libraries (${PROJECT_NAME} INTERFACE ${Boost_SYSTEM_LIBRARY})
|
||||
if (NOT MSVC)
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads)
|
||||
target_link_libraries (${PROJECT_NAME} INTERFACE Threads::Threads)
|
||||
endif()
|
||||
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)
|
||||
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)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#
|
||||
@@ -149,6 +150,10 @@ include_directories (.)
|
||||
include_directories (extras)
|
||||
include_directories (include)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
include_directories (${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set(ZLIB_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/crc32.h
|
||||
${PROJECT_SOURCE_DIR}/test/zlib/zlib-1.2.8/deflate.h
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# Part of Beast
|
||||
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(example/echo-op "/")
|
||||
|
@@ -4,11 +4,12 @@ GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(example/http-client-ssl "/")
|
||||
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
add_executable (http-client-ssl
|
||||
${BEAST_INCLUDES}
|
||||
http_client_ssl.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(http-client-ssl Beast ${OPENSSL_LIBRARIES})
|
||||
target_link_libraries(http-client-ssl
|
||||
Beast
|
||||
${OPENSSL_LIBRARIES}
|
||||
)
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# Part of Beast
|
||||
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(example/http-client "/")
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# Part of Beast
|
||||
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(example/http-crawl "/")
|
||||
|
@@ -4,10 +4,6 @@ GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(example/server-framework "/")
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
add_executable (server-framework
|
||||
${BEAST_INCLUDES}
|
||||
${SERVER_INCLUDES}
|
||||
@@ -21,5 +17,5 @@ target_link_libraries(
|
||||
${Boost_FILESYSTEM_LIBRARY})
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
target_link_libraries(server-framework ${OPENSSL_LIBRARIES})
|
||||
target_link_libraries(server-framework ${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
|
@@ -4,11 +4,12 @@ GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(example/websocket-client-ssl "/")
|
||||
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
add_executable (websocket-client-ssl
|
||||
${BEAST_INCLUDES}
|
||||
websocket_client_ssl.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(websocket-client-ssl Beast ${OPENSSL_LIBRARIES})
|
||||
target_link_libraries(websocket-client-ssl
|
||||
Beast
|
||||
${OPENSSL_LIBRARIES}
|
||||
)
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# Part of Beast
|
||||
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(example/websocket-client "/")
|
||||
|
@@ -13,6 +13,7 @@ if ((NOT "${VARIANT}" STREQUAL "coverage") AND
|
||||
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(test "/")
|
||||
|
||||
add_executable (lib-tests
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(test/benchmarks "/")
|
||||
GroupSources(test/http "/")
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
GroupSources(examples examples)
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(test/core "/")
|
||||
|
||||
add_executable (core-tests
|
||||
|
@@ -6,10 +6,6 @@ GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(test/server "/")
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
add_executable (server-test
|
||||
${BEAST_INCLUDES}
|
||||
${SERVER_INCLUDES}
|
||||
@@ -42,5 +38,5 @@ target_link_libraries(server-test
|
||||
)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
target_link_libraries(server-test ${OPENSSL_LIBRARIES})
|
||||
target_link_libraries (server-test ${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
|
@@ -2,13 +2,10 @@
|
||||
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(test/websocket "/")
|
||||
|
||||
include_directories(../../example/)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
#include_directories(../../example/)
|
||||
|
||||
add_executable (websocket-tests
|
||||
${BEAST_INCLUDES}
|
||||
@@ -37,5 +34,5 @@ target_link_libraries(websocket-tests
|
||||
)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
target_link_libraries(websocket-tests ${OPENSSL_LIBRARIES})
|
||||
target_link_libraries(websocket-tests ${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
GroupSources(extras/beast extras)
|
||||
GroupSources(include/beast beast)
|
||||
|
||||
GroupSources(test/zlib "/")
|
||||
|
||||
if (MSVC)
|
||||
|
Reference in New Issue
Block a user