Files
boost_mqtt5/example/CMakeLists.txt
Bruno Iljazovic 43845343a2 CI: update Codecov action to v5
Reviewers: korina

Reviewed By: korina

Subscribers: miljen

Differential Revision: https://repo.mireo.local/D33801
2025-02-18 12:03:43 +01:00

29 lines
807 B
CMake

#
# Copyright (c) 2023-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)
#
cmake_minimum_required(VERSION 3.8...3.20)
project(boost-mqtt5-examples LANGUAGES CXX)
function(add_example name)
add_executable("${name}" ${ARGN})
target_link_libraries("${name}" PRIVATE Boost::mqtt5)
string(FIND "${example_name}" "tls" found_tls)
if(found_tls GREATER -1)
target_link_libraries("${name}" PRIVATE OpenSSL::SSL)
endif()
endfunction()
file(GLOB examples "*.cpp")
foreach(file_path ${examples})
get_filename_component(example_name "${file_path}" NAME_WE)
add_example("${example_name}" "${file_path}")
endforeach()
find_package(OpenSSL REQUIRED)