2025-02-12 15:49:45 +01:00
|
|
|
#
|
2025-02-14 13:42:23 +01:00
|
|
|
# Copyright (c) 2023-2025 Ivica Siladic, Bruno Iljazovic, Korina Simicevic
|
2025-02-12 15:49:45 +01:00
|
|
|
#
|
|
|
|
|
# Distributed under the Boost Software License, Version 1.0.
|
|
|
|
|
# (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
|
#
|
2023-11-29 00:48:21 +01:00
|
|
|
|
2025-02-12 15:49:45 +01:00
|
|
|
cmake_minimum_required(VERSION 3.8...3.20)
|
2023-11-29 00:48:21 +01:00
|
|
|
|
2025-02-12 15:49:45 +01:00
|
|
|
project(async-mqtt5-examples LANGUAGES CXX)
|
2023-11-29 00:48:21 +01:00
|
|
|
|
2024-12-03 15:26:05 +01:00
|
|
|
function(add_example name)
|
|
|
|
|
add_executable("${name}" ${ARGN})
|
2025-02-12 15:49:45 +01:00
|
|
|
target_link_libraries("${name}" PRIVATE Boost::mqtt5)
|
2024-12-03 15:26:05 +01:00
|
|
|
string(FIND "${example_name}" "tls" found_tls)
|
|
|
|
|
if(found_tls GREATER -1)
|
|
|
|
|
target_link_libraries("${name}" PRIVATE OpenSSL::SSL)
|
|
|
|
|
endif()
|
|
|
|
|
endfunction()
|
2023-11-29 00:48:21 +01:00
|
|
|
|
2024-12-03 15:26:05 +01:00
|
|
|
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)
|