Skip to content

Commit be1a1fb

Browse files
committed
In-tree cmake builds instead of FindBoost.
1 parent 2685d44 commit be1a1fb

File tree

4 files changed

+73
-8
lines changed

4 files changed

+73
-8
lines changed

CMakeLists.txt

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,76 @@ target_compile_features(boost_redis INTERFACE cxx_std_17)
1919

2020
# Dependencies
2121
if (BOOST_REDIS_MAIN_PROJECT)
22-
# If we're the root project, error if a dependency is not found
23-
find_package(Boost 1.83 REQUIRED COMPONENTS headers)
22+
# TODO: Understand why we have to list all dependencies below
23+
# instead of
24+
#set(BOOST_INCLUDE_LIBRARIES redis)
25+
#set(BOOST_EXCLUDE_LIBRARIES redis)
26+
#add_subdirectory(../.. boostorg/boost EXCLUDE_FROM_ALL)
27+
28+
set(deps
29+
system
30+
assert
31+
config
32+
throw_exception
33+
asio
34+
variant2
35+
mp11
36+
winapi
37+
predef
38+
align
39+
context
40+
core
41+
coroutine
42+
static_assert
43+
pool
44+
date_time
45+
smart_ptr
46+
exception
47+
integer
48+
move
49+
type_traits
50+
algorithm
51+
utility
52+
io
53+
lexical_cast
54+
numeric/conversion
55+
mpl
56+
range
57+
tokenizer
58+
tuple
59+
array
60+
bind
61+
concept_check
62+
function
63+
iterator
64+
regex
65+
unordered
66+
preprocessor
67+
container
68+
conversion
69+
container_hash
70+
detail
71+
optional
72+
function_types
73+
fusion
74+
intrusive
75+
describe
76+
typeof
77+
functional
78+
test
79+
json
80+
)
81+
82+
foreach(dep IN LISTS deps)
83+
add_subdirectory(../${dep} boostorg/${dep})
84+
endforeach()
85+
2486
find_package(Threads REQUIRED)
2587
find_package(OpenSSL REQUIRED)
2688
target_link_libraries(boost_redis
2789
INTERFACE
28-
Boost::headers
90+
Boost::system
91+
Boost::asio
2992
Threads::Threads
3093
OpenSSL::Crypto
3194
OpenSSL::SSL

example/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ macro(make_example EXAMPLE_NAME STANDARD)
1010
if (${STANDARD} STREQUAL "20")
1111
target_link_libraries(${EXAMPLE_NAME} PRIVATE examples_main)
1212
endif()
13+
if (${STANDARD} STREQUAL "20")
14+
target_link_libraries(${EXAMPLE_NAME} PRIVATE Boost::json)
15+
endif()
1316
endmacro()
1417

1518
macro(make_testable_example EXAMPLE_NAME STANDARD)
@@ -46,4 +49,4 @@ endif()
4649

4750
if (NOT MSVC)
4851
make_example(cpp20_chat_room 20)
49-
endif()
52+
endif()

example/cpp20_json.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515

1616
#if defined(BOOST_ASIO_HAS_CO_AWAIT)
1717

18-
#define BOOST_JSON_NO_LIB
19-
#define BOOST_CONTAINER_NO_LIB
2018
#include <boost/json/serialize.hpp>
2119
#include <boost/json/parse.hpp>
2220
#include <boost/json/value_from.hpp>
21+
#include <boost/json/value_to.hpp>
2322
#include <boost/redis/resp3/serialization.hpp>
24-
#include <boost/json/src.hpp>
2523

2624
namespace asio = boost::asio;
2725
using namespace boost::describe;

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ macro(make_test TEST_NAME STANDARD)
2323
boost_redis_src
2424
boost_redis_tests_common
2525
boost_redis_project_options
26+
Boost::unit_test_framework
2627
)
2728
target_compile_features(${EXE_NAME} PRIVATE cxx_std_${STANDARD})
2829
add_test(${EXE_NAME} ${EXE_NAME})
@@ -70,4 +71,4 @@ add_custom_target(
7071
COMMAND ${COVERAGE_HTML_COMMAND}
7172
COMMENT "Generating coverage report"
7273
VERBATIM
73-
)
74+
)

0 commit comments

Comments
 (0)