Skip to content

Commit 6f5c179

Browse files
Korina Šimičevićsiladic
authored andcommitted
CMakeLists.txt modifications
1 parent 6abe93f commit 6f5c179

File tree

5 files changed

+45
-41
lines changed

5 files changed

+45
-41
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.15)
22

3-
project(async-mqtt5 VERSION 0.0.1 LANGUAGES NONE)
3+
project(async-mqtt5 VERSION 0.0.1 LANGUAGES CXX)
44

55
include(cmake/project-is-top-level.cmake)
66
include(cmake/variables.cmake)
@@ -19,10 +19,13 @@ target_include_directories(
1919
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
2020
)
2121

22-
target_compile_features(async_mqtt5 INTERFACE cxx_std_20)
22+
target_compile_features(async_mqtt5 INTERFACE cxx_std_17)
2323

2424
find_package(Boost 1.82 REQUIRED)
25-
target_link_libraries(async_mqtt5 INTERFACE Boost::headers)
25+
target_link_libraries(async_mqtt5
26+
INTERFACE
27+
Boost::headers
28+
)
2629

2730
if(NOT CMAKE_SKIP_INSTALL_RULES)
2831
include(cmake/install-rules.cmake)

example/CMakeLists.txt

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,27 @@ project(async-mqtt5-examples CXX)
55
include(../cmake/project-is-top-level.cmake)
66

77
if(PROJECT_IS_TOP_LEVEL)
8-
find_package(async_mqtt5 REQUIRED)
8+
find_package(async-mqtt5 REQUIRED)
99
endif()
1010

1111
function(add_example name)
1212
add_executable("${name}" ${ARGN})
13-
target_compile_features("${name}" PRIVATE cxx_std_20)
13+
target_compile_features("${name}" PRIVATE cxx_std_20) # for coroutines
1414
target_link_libraries("${name}" PRIVATE Async::MQTT5)
1515
endfunction()
1616

17-
foreach(f callbacks cpp20_coroutines futures publisher receiver)
18-
add_example("${f}" "${f}.cpp")
19-
endforeach()
17+
foreach(f publisher receiver)
18+
add_example("${f}" "${f}.cpp")
19+
endforeach()
2020

21-
#[[
22-
add_example(
23-
misc
24-
src/run_examples.cpp
25-
network_connection.cpp
26-
openssl-tls.cpp
21+
set(EXAMPLES
2722
tcp.cpp
28-
websocket-tcp.cpp
29-
websocket-tls.cpp
23+
openssl_tls.cpp
24+
websocket_tcp.cpp
25+
websocket_tls.cpp
3026
)
3127

3228
find_package(OpenSSL REQUIRED)
33-
target_link_libraries(misc PRIVATE OpenSSL::SSL)
34-
]]
29+
add_executable(examples src/run_examples.cpp ${EXAMPLES})
30+
target_compile_features(examples PRIVATE cxx_std_17)
31+
target_link_libraries(examples PRIVATE Async::MQTT5 OpenSSL::SSL)

test/unit/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(async-mqtt5-tests CXX)
55
include(../../cmake/project-is-top-level.cmake)
66

77
if(PROJECT_IS_TOP_LEVEL)
8-
find_package(async_mqtt5 REQUIRED)
8+
find_package(async-mqtt5 REQUIRED)
99
enable_testing()
1010
endif()
1111

@@ -14,16 +14,20 @@ add_executable(
1414
src/run_tests.cpp
1515
test/cancellation.cpp
1616
test/client_broker.cpp
17+
test/compilation_checks.cpp
1718
test/coroutine.cpp
1819
test/publish_send_op.cpp
1920
test/serialization.cpp
2021
test/session.cpp
22+
test/string_validation.cpp
23+
test/subscribe_op.cpp
2124
)
2225

2326
target_include_directories(mqtt-test PRIVATE include)
24-
target_compile_features(mqtt-test PRIVATE cxx_std_20)
27+
target_compile_features(mqtt-test PRIVATE cxx_std_17)
28+
target_compile_definitions(mqtt-test PRIVATE BOOST_TEST_NO_MAIN=1)
2529

26-
find_package(Boost 1.82 REQUIRED unit_test_framework)
27-
target_link_libraries(mqtt-test PRIVATE Async::MQTT5 Boost::unit_test_framework)
30+
find_package(OpenSSL)
31+
target_link_libraries(mqtt-test PRIVATE Async::MQTT5 OpenSSL::SSL)
2832

2933
add_test(NAME mqtt-test COMMAND mqtt-test)

test/unit/src/run_tests.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,17 @@
1-
#include <boost/test/unit_test.hpp>
1+
#include <boost/test/included/unit_test.hpp>
22

33
#include <test_common/protocol_logging.hpp>
44

5-
namespace {
6-
7-
void setup_mqtt() {
5+
boost::unit_test::test_suite* init_tests(
6+
int /*argc*/, char* /*argv*/[]
7+
) {
88
async_mqtt5::test::logging_enabled() = true;
9-
}
10-
11-
}
12-
13-
#ifdef BOOST_TEST_DYN_LINK
14-
static bool init_tests() {
15-
setup_mqtt();
16-
return true;
9+
return nullptr;
1710
}
1811

1912
int main(int argc, char* argv[]) {
2013
return boost::unit_test::unit_test_main(&init_tests, argc, argv);
2114
}
22-
#else
23-
boost::unit_test::test_suite* init_unit_test_suite(int, char** const) {
24-
setup_mqtt();
25-
return nullptr;
26-
}
27-
#endif
2815

2916
/*
3017
* usage: ./mqtt-test [boost test --arg=val]*

vcpkg.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,18 @@
1919
}
2020
]
2121
}
22-
}
22+
},
23+
"vcpkg-configuration": {
24+
"default-registry": {
25+
"kind": "git",
26+
"repository": "https://github.com/microsoft/vcpkg",
27+
"baseline": "4cac260c4b7331538d31886f57739fea0bffa27e"
28+
}
29+
},
30+
"overrides": [
31+
{
32+
"name": "openssl",
33+
"version-string": "1.1.1n"
34+
}
35+
]
2336
}

0 commit comments

Comments
 (0)