2
0
mirror of https://github.com/boostorg/mqtt5.git synced 2026-01-19 04:22:11 +00:00
Files
mqtt5/test/CMakeLists.txt
Bruno Iljazovic 7d18f20e56 Add Jamfile, make CMake scripts Boost compliant
Summary: related to T15996

Reviewers: ivica, korina

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D33480
2025-02-12 15:54:14 +01:00

46 lines
1.3 KiB
CMake

#
# Copyright (c) 2025 Ivica Siladic, Bruno Iljazovic, Korina Simicevic
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
#
project(boost_mqtt5_tests CXX)
file(GLOB integration_tests "integration/*.cpp")
file(GLOB unit_tests "unit/*.cpp")
add_executable(mqtt-test src/run_tests.cpp ${integration_tests} ${unit_tests})
target_include_directories(mqtt-test PRIVATE include)
target_compile_definitions(mqtt-test PRIVATE BOOST_TEST_NO_MAIN=1)
if(BOOST_MQTT5_MAIN_PROJECT)
find_package(OpenSSL REQUIRED)
target_compile_definitions(mqtt-test PRIVATE BOOST_MQTT5_EXTRA_DEPS=1)
target_link_libraries(
mqtt-test PRIVATE
Boost::mqtt5
OpenSSL::SSL
)
else()
target_link_libraries(
mqtt-test PRIVATE
Boost::mqtt5
Boost::included_unit_test_framework
)
# Follow the Boost convention: don't build test targets by default,
# and only when explicitly requested by building target tests
set_target_properties(mqtt-test PROPERTIES EXCLUDE_FROM_ALL ON)
add_dependencies(tests mqtt-test)
endif()
include(CTest)
add_test(NAME mqtt-test COMMAND mqtt-test)
if (BOOST_MQTT5_PUBLIC_BROKER_TESTS)
set_property(TEST mqtt-test PROPERTY ENVIRONMENT "BOOST_MQTT5_PUBLIC_BROKER_TESTS=1")
endif()