Refactor CMakeLists

Closes #2471
Closes #1816
This commit is contained in:
Mohammad Nejati
2024-11-20 19:54:25 +00:00
committed by Mohammad Nejati
parent a21250d12d
commit 75e45287fb
82 changed files with 916 additions and 1359 deletions

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,70 +8,65 @@
# Official repository: https://github.com/boostorg/beast
#
include_directories (./extern)
include_directories (./extras/include)
find_package(OpenSSL)
file (GLOB_RECURSE EXTRAS_FILES
${PROJECT_SOURCE_DIR}/test/extras/include/*.hpp
${PROJECT_SOURCE_DIR}/test/extras/include/*.ipp
${PROJECT_SOURCE_DIR}/test/lib_ssl.cpp
)
# lib-asio
add_library(lib-asio STATIC lib_asio.cpp)
target_compile_definitions(lib-asio PUBLIC
BOOST_ASIO_SEPARATE_COMPILATION
BOOST_ASIO_NO_DEPRECATED
BOOST_ASIO_DISABLE_BOOST_ARRAY
BOOST_ASIO_DISABLE_BOOST_BIND
BOOST_ASIO_DISABLE_BOOST_DATE_TIME
BOOST_ASIO_DISABLE_BOOST_REGEX)
target_link_libraries(lib-asio PUBLIC Boost::asio)
set_target_properties(lib-asio PROPERTIES FOLDER "static-libs")
if (OPENSSL_FOUND)
link_libraries (${OPENSSL_LIBRARIES})
endif()
# lib-asio-ssl
add_library(lib-asio-ssl STATIC lib_asio_ssl.cpp)
target_link_libraries(lib-asio-ssl PUBLIC lib-asio)
target_link_libraries(lib-asio-ssl PUBLIC OpenSSL::SSL OpenSSL::Crypto)
set_target_properties(lib-asio-ssl PROPERTIES FOLDER "static-libs")
set (ZLIB_SOURCES
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/crc32.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/deflate.h
#${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/gzguts.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/inffast.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/inffixed.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/inflate.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/inftrees.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/trees.h
#${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/zconf.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/zlib.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/zutil.h
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/adler32.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/compress.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/crc32.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/deflate.c
#${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/gzclose.c
#${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/gzlib.c
#${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/gzread.c
#${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/gzwrite.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/infback.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/inffast.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/inflate.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/inftrees.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/trees.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/uncompr.c
${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12/zutil.c
)
# lib-beast
add_library(lib-beast STATIC lib_beast.cpp)
target_compile_definitions(lib-beast PUBLIC BOOST_BEAST_SEPARATE_COMPILATION)
target_link_libraries(lib-beast PUBLIC Boost::beast lib-asio)
set_target_properties(lib-beast PROPERTIES FOLDER "static-libs")
add_library (
lib-zlib
${ZLIB_SOURCES}
)
target_include_directories(lib-zlib PUBLIC "${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.12")
set_property(TARGET lib-zlib PROPERTY FOLDER "static-libs")
# lib-zlib
enable_language(C)
add_library(lib-zlib STATIC
extern/zlib-1.2.12/adler32.c
extern/zlib-1.2.12/compress.c
extern/zlib-1.2.12/crc32.c
extern/zlib-1.2.12/deflate.c
extern/zlib-1.2.12/infback.c
extern/zlib-1.2.12/inffast.c
extern/zlib-1.2.12/inflate.c
extern/zlib-1.2.12/inftrees.c
extern/zlib-1.2.12/trees.c
extern/zlib-1.2.12/uncompr.c
extern/zlib-1.2.12/zutil.c)
target_compile_options(lib-zlib PRIVATE
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-w>
$<$<CXX_COMPILER_ID:MSVC>:/wd4127>
$<$<CXX_COMPILER_ID:MSVC>:/wd4244>
$<$<CXX_COMPILER_ID:MSVC>:/wd4131>)
target_include_directories(lib-zlib PUBLIC extern/zlib-1.2.12)
set_target_properties(lib-zlib PROPERTIES FOLDER "static-libs")
set (TEST_MAIN ${PROJECT_SOURCE_DIR}/test/lib_beast.cpp)
# lib-test
add_library(lib-test STATIC lib_test.cpp)
target_include_directories(lib-test PUBLIC extras/include)
target_link_libraries(lib-test PUBLIC lib-beast)
set_target_properties(lib-test PROPERTIES FOLDER "static-libs")
GroupSources (. "/")
add_subdirectory(beast)
add_subdirectory(bench)
add_subdirectory(doc)
add_subdirectory(example)
add_library (
lib-test STATIC
${CMAKE_CURRENT_LIST_DIR}/lib_test.cpp
)
set_property(TARGET lib-test PROPERTY FOLDER "static-libs")
add_subdirectory (beast)
add_subdirectory (bench)
add_subdirectory (doc)
add_subdirectory (example)
if (Beast_BUILD_FUZZERS AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if (BOOST_BEAST_BUILD_FUZZERS AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_subdirectory(fuzz)
endif()
endif ()

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,73 +8,28 @@
# Official repository: https://github.com/boostorg/beast
#
function(build_individual_tests prefix)
set(options )
set(oneValueArgs )
set(multiValueArgs EXCLUDE LIBS EXTRA)
cmake_parse_arguments(bit "${options}"
"${oneValueArgs}" "${multiValueArgs}" ${ARGN})
add_definitions(-DBOOST_BEAST_ALLOW_DEPRECATED)
add_definitions(-DBOOST_BEAST_TESTS) # For buffers_cat
file(GLOB test_srcs "*.cpp")
set(individual_tests)
foreach(test_src IN LISTS test_srcs)
get_filename_component(test_suffix "${test_src}" NAME_WE)
if(NOT test_suffix IN_LIST bit_EXCLUDE)
set(test_name "${prefix}-${test_suffix}")
add_executable("${test_name}" EXCLUDE_FROM_ALL "${test_src}")
foreach(lib IN LISTS bit_LIBS)
target_link_libraries("${test_name}" "${lib}")
endforeach()
list(APPEND individual_tests COMMAND "${test_name}")
endif()
endforeach()
add_subdirectory(_experimental)
add_subdirectory(core)
add_subdirectory(http)
add_subdirectory(ssl)
add_subdirectory(websocket)
add_subdirectory(zlib)
add_custom_target("${prefix}-all" ${individual_tests})
endfunction()
add_definitions (-DBOOST_BEAST_ALLOW_DEPRECATED)
# For buffers_cat
add_definitions (-DBOOST_BEAST_TESTS)
add_subdirectory (_experimental)
add_subdirectory (core)
add_subdirectory (http)
add_subdirectory (ssl)
add_subdirectory (websocket)
add_subdirectory (zlib)
#-------------------------------------------------------------------------------
GroupSources (include/boost/beast beast)
GroupSources (test/extras/include/boost /)
GroupSources (test/beast /)
add_executable (tests-beast
${BOOST_BEAST_FILES}
${EXTRAS_FILES}
add_executable(tests-beast
Jamfile
core.cpp
http.cpp
ssl.cpp
version.cpp
websocket.cpp
zlib.cpp
)
zlib.cpp)
target_link_libraries(tests-beast
lib-asio
lib-asio-ssl
lib-beast
lib-test)
set_property(TARGET tests-beast PROPERTY FOLDER "tests")
#add_custom_target(tests-beast-all
# DEPENDS
# tests-beast-_experimental-all
# tests-beast-core-all
# tests-beast-http-all
# tests-beast-ssl-all
# tests-beast-websocket-all
# tests-beast-zlib-all )
set_target_properties(tests-beast
PROPERTIES FOLDER "tests")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,29 +8,15 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/beast/_experimental "/")
add_executable (tests-beast-_experimental
${BOOST_BEAST_FILES}
add_executable(tests-beast-_experimental
Jamfile
_test_detail_stream_state.cpp
error.cpp
icy_stream.cpp
stream.cpp
)
stream.cpp)
target_link_libraries(tests-beast-_experimental
lib-asio
lib-beast
lib-test
)
lib-test)
set_property(TARGET tests-beast-_experimental PROPERTY FOLDER "tests")
#
# Individual tests
#
#build_individual_tests(tests-beast-_experimental
# EXCLUDE
# LIBS lib-asio lib-asio-ssl lib-beast lib-test)
set_target_properties(tests-beast-_experimental
PROPERTIES FOLDER "tests")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,11 +8,7 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/beast/core "/")
add_executable (tests-beast-core
${BOOST_BEAST_FILES}
add_executable(tests-beast-core
Jamfile
test_buffer.hpp
file_test.hpp
@@ -64,21 +61,11 @@ add_executable (tests-beast-core
static_string.cpp
stream_traits.cpp
string.cpp
tcp_stream.cpp
)
tcp_stream.cpp)
target_link_libraries(tests-beast-core
lib-asio
lib-asio-ssl
lib-beast
lib-test
)
Boost::filesystem)
set_property(TARGET tests-beast-core PROPERTY FOLDER "tests")
#
# Individual tests
#
#build_individual_tests(tests-beast-core
# EXCLUDE _detail_static_const close_socket zlib make_strand prepare_buffers
# LIBS lib-asio lib-asio-ssl lib-beast lib-test)
set_target_properties(tests-beast-core
PROPERTIES FOLDER "tests")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,13 +8,7 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/extras/include/boost/beast extras)
GroupSources (test/beast/http "/")
add_executable (tests-beast-http
${BOOST_BEAST_FILES}
${EXTRAS_FILES}
Jamfile
any_completion_handler.cpp
basic_dynamic_body_fwd.cpp
@@ -55,19 +50,11 @@ add_executable (tests-beast-http
vector_body_fwd.cpp
vector_body.cpp
verb.cpp
write.cpp
)
write.cpp)
target_link_libraries(tests-beast-http
lib-asio
lib-asio-ssl
lib-beast
lib-test
)
Boost::filesystem)
set_property(TARGET tests-beast-http PROPERTY FOLDER "tests")
#
# Individual tests
#
#build_individual_tests(tests-beast-http LIBS lib-asio lib-asio-ssl lib-beast lib-test)
set_target_properties(tests-beast-http
PROPERTIES FOLDER "tests")

View File

@@ -7,22 +7,13 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/beast/ssl "/")
add_executable (tests-beast-ssl
${BOOST_BEAST_FILES}
Jamfile
ssl_stream.cpp
)
ssl_stream.cpp)
target_link_libraries(tests-beast-ssl
lib-asio
lib-asio-ssl
lib-beast
lib-test
)
lib-test)
set_property(TARGET tests-beast-ssl PROPERTY FOLDER "tests")
#build_individual_tests(tests-beast-ssl LIBS lib-asio lib-asio-ssl lib-beast lib-test)
set_target_properties(tests-beast-ssl
PROPERTIES FOLDER "tests")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,13 +8,7 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/extras/include/boost/beast extras)
GroupSources (test/beast/websocket "/")
add_executable (tests-beast-websocket
${BOOST_BEAST_FILES}
${EXTRAS_FILES}
Jamfile
_detail_decorator.cpp
_detail_prng.cpp
@@ -42,18 +37,11 @@ add_executable (tests-beast-websocket
teardown.cpp
timer.cpp
utf8_checker.cpp
write.cpp
)
write.cpp)
target_link_libraries(tests-beast-websocket
lib-asio
lib-asio-ssl
lib-beast
lib-test
)
lib-test)
set_property(TARGET tests-beast-websocket PROPERTY FOLDER "tests")
#build_individual_tests(tests-beast-websocket
# EXCLUDE doc_snippets
# LIBS lib-asio lib-asio-ssl lib-beast lib-test)
set_target_properties(tests-beast-websocket
PROPERTIES FOLDER "tests")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,30 +8,19 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/extern/zlib-1.2.12 zlib)
GroupSources (test/beast/zlib "/")
if (MSVC)
set_source_files_properties (${ZLIB_SOURCES} PROPERTIES COMPILE_FLAGS "/wd4127 /wd4131 /wd4244")
endif()
add_executable (tests-beast-zlib
${BOOST_BEAST_FILES}
${ZLIB_SOURCES}
Jamfile
error.cpp
deflate_stream.cpp
inflate_stream.cpp
zlib.cpp
)
zlib.cpp)
target_include_directories(tests-beast-zlib
PRIVATE ${PROJECT_SOURCE_DIR}/test/extern)
target_link_libraries(tests-beast-zlib
lib-asio
lib-beast
lib-test
)
lib-zlib)
set_property(TARGET tests-beast-zlib PROPERTY FOLDER "tests")
#build_individual_tests(tests-beast-zlib LIBS lib-asio lib-beast lib-test lib-zlib)
set_target_properties(tests-beast-zlib
PROPERTIES FOLDER "tests")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,8 +8,8 @@
# Official repository: https://github.com/boostorg/beast
#
add_subdirectory (buffers)
add_subdirectory (parser)
add_subdirectory (utf8_checker)
add_subdirectory (wsload)
add_subdirectory (zlib)
add_subdirectory(buffers)
add_subdirectory(parser)
add_subdirectory(utf8_checker)
add_subdirectory(wsload)
add_subdirectory(zlib)

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,19 +8,12 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/bench/buffers "/")
add_executable (bench-buffers
${BOOST_BEAST_FILES}
add_executable(bench-buffers
Jamfile
bench_buffers.cpp
)
bench_buffers.cpp)
target_link_libraries(bench-buffers
lib-asio
lib-beast
lib-test
)
lib-test)
set_property(TARGET bench-buffers PROPERTY FOLDER "tests-bench")
set_target_properties(bench-buffers
PROPERTIES FOLDER "tests-bench")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,23 +8,17 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/beast/http "/")
GroupSources (test/bench/parser "/")
add_executable (bench-parser
${BOOST_BEAST_FILES}
add_executable(bench-parser
Jamfile
${PROJECT_SOURCE_DIR}/test/beast/http/message_fuzz.hpp
nodejs_parser.hpp
nodejs_parser.cpp
bench_parser.cpp
)
bench_parser.cpp)
target_include_directories(bench-parser
PRIVATE ${PROJECT_SOURCE_DIR})
target_link_libraries(bench-parser
lib-asio
lib-beast
lib-test
)
lib-test)
set_property(TARGET bench-parser PROPERTY FOLDER "tests-bench")
set_target_properties(bench-parser
PROPERTIES FOLDER "tests-bench")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,19 +8,12 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/bench/utf8_checker "/")
add_executable (bench-utf8-checker
${BOOST_BEAST_FILES}
add_executable(bench-utf8-checker
Jamfile
bench_utf8_checker.cpp
)
bench_utf8_checker.cpp)
target_link_libraries(bench-utf8-checker
lib-asio
lib-beast
lib-test
)
lib-test)
set_property(TARGET bench-utf8-checker PROPERTY FOLDER "tests-bench")
set_target_properties(bench-utf8-checker
PROPERTIES FOLDER "tests-bench")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,18 +8,12 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/bench/wsload "/")
add_executable (bench-wsload
${BOOST_BEAST_FILES}
add_executable(bench-wsload
Jamfile
wsload.cpp
)
wsload.cpp)
target_link_libraries(bench-wsload
lib-asio
lib-beast
)
lib-beast)
set_property(TARGET bench-wsload PROPERTY FOLDER "tests-bench")
set_target_properties(bench-wsload
PROPERTIES FOLDER "tests-bench")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,25 +8,17 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (test/extern/zlib-1.2.12 zlib)
GroupSources (test/bench/zlib "/")
if (MSVC)
set_source_files_properties (${ZLIB_SOURCES} PROPERTIES COMPILE_FLAGS "/wd4127 /wd4131 /wd4244")
endif()
add_executable (bench-zlib
${BOOST_BEAST_FILES}
${ZLIB_SOURCES}
Jamfile
deflate_stream.cpp
inflate_stream.cpp
)
target_link_libraries(bench-zlib
lib-asio
lib-beast
lib-test
)
inflate_stream.cpp)
set_property(TARGET bench-zlib PROPERTY FOLDER "tests-bench")
target_include_directories(bench-zlib
PRIVATE ${PROJECT_SOURCE_DIR}/test/extern)
target_link_libraries(bench-zlib
lib-test
lib-zlib)
set_target_properties(bench-zlib
PROPERTIES FOLDER "tests-bench")

View File

@@ -0,0 +1,93 @@
#
# Copyright (c) 2023 Christian Mazakas
# Copyright (c) 2022 alandefreitas (alandefreitas@gmail.com)
#
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
#
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_subdir_test LANGUAGES CXX)
set(__ignore__ ${CMAKE_C_COMPILER})
set(__ignore__ ${CMAKE_C_FLAGS})
if(BOOST_CI_INSTALL_TEST)
find_package(Boost CONFIG REQUIRED COMPONENTS beast)
else()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_subdirectory(../.. boostorg/beast)
set(BOOST_URL_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(deps
# Primary dependencies
asio
assert
bind
config
container
container_hash
core
endian
intrusive
logic
mp11
optional
preprocessor
smart_ptr
static_assert
static_string
system
throw_exception
type_index
type_traits
winapi
# Secondary dependencies
align
context
date_time
move
describe
utility
variant2
predef
pool
algorithm
io
lexical_cast
numeric/conversion
range
tokenizer
array
concept_check
exception
function
iterator
mpl
regex
tuple
unordered
conversion
integer
detail
function_types
fusion
functional
typeof
)
foreach(dep IN LISTS deps)
add_subdirectory(../../../${dep} boostorg/${dep} EXCLUDE_FROM_ALL)
endforeach()
endif()
add_executable(main main.cpp)
target_link_libraries(main Boost::beast)
enable_testing()
add_test(NAME main COMMAND main)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

5
test/cmake_test/main.cpp Normal file
View File

@@ -0,0 +1,5 @@
#include <boost/beast.hpp>
int main() {
}

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,12 +8,7 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (example example)
GroupSources (test/doc "/")
add_executable (tests-doc
${BOOST_BEAST_FILES}
Jamfile
snippets.hpp
snippets.ipp
@@ -33,14 +29,14 @@ add_executable (tests-doc
websocket_6_timeouts.cpp
websocket_7_teardown.cpp
websocket_8_notes.cpp
exemplars.cpp
)
exemplars.cpp)
target_include_directories(tests-doc
PRIVATE ${PROJECT_SOURCE_DIR})
target_link_libraries(tests-doc
lib-asio
lib-asio-ssl
lib-beast
lib-test
)
lib-test)
set_property(TARGET tests-doc PROPERTY FOLDER "tests")
set_target_properties(tests-doc
PROPERTIES FOLDER "tests")

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,4 +8,4 @@
# Official repository: https://github.com/boostorg/beast
#
add_subdirectory (common)
add_subdirectory(common)

View File

@@ -1,5 +1,6 @@
#
# Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
# Copyright (c) 2024 Mohammad Nejati
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,25 +8,17 @@
# Official repository: https://github.com/boostorg/beast
#
GroupSources (include/boost/beast beast)
GroupSources (example/common common)
GroupSources (test/extras/include/boost/beast extras)
GroupSources (test/example/common "/")
add_executable (tests-example-common
${BOOST_BEAST_FILES}
${COMMON_FILES}
${EXTRAS_FILES}
Jamfile
root_certificates.cpp
server_certificate.cpp
)
server_certificate.cpp)
target_include_directories(tests-example-common
PRIVATE ${PROJECT_SOURCE_DIR})
target_link_libraries(tests-example-common
lib-asio
lib-asio-ssl
lib-beast
lib-test
)
lib-test)
set_property(TARGET tests-example-common PROPERTY FOLDER "tests")
set_target_properties(tests-example-common
PROPERTIES FOLDER "tests")

View File

@@ -36,7 +36,6 @@ add_custom_target(
WORKING_DIRECTORY ${BOOST_BEAST_FUZZER_SEEDS_PARENT_DIR}
COMMENT "Unzipping fuzz seeds"
VERBATIM)
set(BOOST_BEAST_FUZZER_CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/corpus)
set(BOOST_BEAST_FUZZER_MERGED_CORPUS_DIR ${CMAKE_CURRENT_BINARY_DIR}/merged-corpus)
if(EXISTS ${BOOST_BEAST_FUZZER_CORPUS_PATH})
@@ -54,6 +53,7 @@ else()
COMMENT "Creating fuzz corpus directory"
VERBATIM)
endif()
set_target_properties(untar_corpus untar_seeds PROPERTIES FOLDER "fuzzing")
add_dependencies(untar_corpus untar_seeds)
# Target that runs all fuzz targets
@@ -64,6 +64,7 @@ add_custom_target(
COMMAND ${CMAKE_COMMAND} -E tar cf ${BOOST_BEAST_FUZZER_CORPUS_PATH} ${BOOST_BEAST_FUZZER_CORPUS_DIR}
WORKING_DIRECTORY ${BOOST_BEAST_FUZZER_CORPUS_PARENT_DIR}
VERBATIM)
set_target_properties(boost_beast_fuzz_all PROPERTIES FOLDER "fuzzing")
# Register a single fuzzer and add as dependency to fuzz target
function(add_boost_beast_fuzzer NAME)
@@ -73,7 +74,7 @@ function(add_boost_beast_fuzzer NAME)
target_link_libraries(fuzzer_${NAME} PRIVATE lib-beast)
target_compile_options(fuzzer_${NAME} PRIVATE -g -O2 -fsanitize=fuzzer,address,undefined -fno-sanitize-recover=undefined)
target_link_libraries(fuzzer_${NAME} PRIVATE -fsanitize=fuzzer,address,undefined)
set_property(TARGET fuzzer_${NAME} PROPERTY FOLDER "fuzzing")
set_target_properties(fuzzer_${NAME} PROPERTIES FOLDER "fuzzing")
# Custom target to run fuzzer executable
add_custom_target(
@@ -106,7 +107,8 @@ function(add_boost_beast_fuzzer NAME)
DEPENDS untar_corpus fuzzer_${NAME})
add_dependencies(fuzz_${NAME} fuzzer_${NAME})
add_dependencies(boost_beast_fuzz_all fuzz_${NAME})
set_property(TARGET fuzz_${NAME} PROPERTY ENVIRONMENT "UBSAN_OPTIONS=halt_on_error=false")
set_target_properties(fuzz_${NAME} PROPERTIES FOLDER "UBSAN_OPTIONS=halt_on_error=false")
set_target_properties(fuzz_${NAME} PROPERTIES FOLDER "fuzzing")
endfunction()
# Register all fuzzers