mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-06-25 04:01:33 +02:00
CMakeLists.txt modifications
This commit is contained in:
committed by
Ivica Siladić
parent
6abe93fcc9
commit
6f5c179929
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(async-mqtt5 VERSION 0.0.1 LANGUAGES NONE)
|
||||
project(async-mqtt5 VERSION 0.0.1 LANGUAGES CXX)
|
||||
|
||||
include(cmake/project-is-top-level.cmake)
|
||||
include(cmake/variables.cmake)
|
||||
@ -19,10 +19,13 @@ target_include_directories(
|
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
)
|
||||
|
||||
target_compile_features(async_mqtt5 INTERFACE cxx_std_20)
|
||||
target_compile_features(async_mqtt5 INTERFACE cxx_std_17)
|
||||
|
||||
find_package(Boost 1.82 REQUIRED)
|
||||
target_link_libraries(async_mqtt5 INTERFACE Boost::headers)
|
||||
target_link_libraries(async_mqtt5
|
||||
INTERFACE
|
||||
Boost::headers
|
||||
)
|
||||
|
||||
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
||||
include(cmake/install-rules.cmake)
|
||||
|
@ -5,30 +5,27 @@ project(async-mqtt5-examples CXX)
|
||||
include(../cmake/project-is-top-level.cmake)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
find_package(async_mqtt5 REQUIRED)
|
||||
find_package(async-mqtt5 REQUIRED)
|
||||
endif()
|
||||
|
||||
function(add_example name)
|
||||
add_executable("${name}" ${ARGN})
|
||||
target_compile_features("${name}" PRIVATE cxx_std_20)
|
||||
target_compile_features("${name}" PRIVATE cxx_std_20) # for coroutines
|
||||
target_link_libraries("${name}" PRIVATE Async::MQTT5)
|
||||
endfunction()
|
||||
|
||||
foreach(f callbacks cpp20_coroutines futures publisher receiver)
|
||||
foreach(f publisher receiver)
|
||||
add_example("${f}" "${f}.cpp")
|
||||
endforeach()
|
||||
|
||||
#[[
|
||||
add_example(
|
||||
misc
|
||||
src/run_examples.cpp
|
||||
network_connection.cpp
|
||||
openssl-tls.cpp
|
||||
set(EXAMPLES
|
||||
tcp.cpp
|
||||
websocket-tcp.cpp
|
||||
websocket-tls.cpp
|
||||
openssl_tls.cpp
|
||||
websocket_tcp.cpp
|
||||
websocket_tls.cpp
|
||||
)
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
target_link_libraries(misc PRIVATE OpenSSL::SSL)
|
||||
]]
|
||||
add_executable(examples src/run_examples.cpp ${EXAMPLES})
|
||||
target_compile_features(examples PRIVATE cxx_std_17)
|
||||
target_link_libraries(examples PRIVATE Async::MQTT5 OpenSSL::SSL)
|
||||
|
@ -5,7 +5,7 @@ project(async-mqtt5-tests CXX)
|
||||
include(../../cmake/project-is-top-level.cmake)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
find_package(async_mqtt5 REQUIRED)
|
||||
find_package(async-mqtt5 REQUIRED)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
@ -14,16 +14,20 @@ add_executable(
|
||||
src/run_tests.cpp
|
||||
test/cancellation.cpp
|
||||
test/client_broker.cpp
|
||||
test/compilation_checks.cpp
|
||||
test/coroutine.cpp
|
||||
test/publish_send_op.cpp
|
||||
test/serialization.cpp
|
||||
test/session.cpp
|
||||
test/string_validation.cpp
|
||||
test/subscribe_op.cpp
|
||||
)
|
||||
|
||||
target_include_directories(mqtt-test PRIVATE include)
|
||||
target_compile_features(mqtt-test PRIVATE cxx_std_20)
|
||||
target_compile_features(mqtt-test PRIVATE cxx_std_17)
|
||||
target_compile_definitions(mqtt-test PRIVATE BOOST_TEST_NO_MAIN=1)
|
||||
|
||||
find_package(Boost 1.82 REQUIRED unit_test_framework)
|
||||
target_link_libraries(mqtt-test PRIVATE Async::MQTT5 Boost::unit_test_framework)
|
||||
find_package(OpenSSL)
|
||||
target_link_libraries(mqtt-test PRIVATE Async::MQTT5 OpenSSL::SSL)
|
||||
|
||||
add_test(NAME mqtt-test COMMAND mqtt-test)
|
||||
|
@ -1,30 +1,17 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
#include <test_common/protocol_logging.hpp>
|
||||
|
||||
namespace {
|
||||
|
||||
void setup_mqtt() {
|
||||
boost::unit_test::test_suite* init_tests(
|
||||
int /*argc*/, char* /*argv*/[]
|
||||
) {
|
||||
async_mqtt5::test::logging_enabled() = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef BOOST_TEST_DYN_LINK
|
||||
static bool init_tests() {
|
||||
setup_mqtt();
|
||||
return true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
return boost::unit_test::unit_test_main(&init_tests, argc, argv);
|
||||
}
|
||||
#else
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int, char** const) {
|
||||
setup_mqtt();
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* usage: ./mqtt-test [boost test --arg=val]*
|
||||
|
13
vcpkg.json
13
vcpkg.json
@ -19,5 +19,18 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"vcpkg-configuration": {
|
||||
"default-registry": {
|
||||
"kind": "git",
|
||||
"repository": "https://github.com/microsoft/vcpkg",
|
||||
"baseline": "4cac260c4b7331538d31886f57739fea0bffa27e"
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"name": "openssl",
|
||||
"version-string": "1.1.1n"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user