build: refactor CMake scripts to use functions for variable scope (#87)
* build: refactor CMake scripts to use functions for variable scope Wrap multiple CMake scripts in functions to restrict variable scope and prevent unintended resets. This ensures better modularity and maintainability in the build process while adhering to modern CMake best practices. * refactor: simplify opentelemetry fetch logic Streamline the handling of OpenTelemetry dependencies by removing unnecessary function wrappers and directly implementing the fetching logic. This improves readability and maintainability while ensuring that relevant variables are correctly set within the proper scope. * refactor: encapsulate OpenTelemetry configuration in a function Wrap the OpenTelemetry setup in a function to limit variable scope, improving code organization and maintainability.
This commit is contained in:
parent
8b6283e684
commit
0a63cb9fe1
@ -5,6 +5,11 @@ cmake_minimum_required(VERSION 3.24)
|
|||||||
|
|
||||||
project(aimrt LANGUAGES C CXX)
|
project(aimrt LANGUAGES C CXX)
|
||||||
|
|
||||||
|
# Prevent variables from being reset by option
|
||||||
|
# This setting allows predefined variables to take precedence for FetchContent_MakeAvailable()
|
||||||
|
# see: https://cmake.org/cmake/help/latest/policy/CMP0077.html
|
||||||
|
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
||||||
|
|
||||||
# Set cmake path
|
# Set cmake path
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
|
|
||||||
|
@ -22,61 +22,66 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(asio)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT asio_POPULATED)
|
function(get_asio)
|
||||||
FetchContent_Populate(asio)
|
FetchContent_GetProperties(asio)
|
||||||
|
if(NOT asio_POPULATED)
|
||||||
|
FetchContent_Populate(asio)
|
||||||
|
|
||||||
add_library(asio INTERFACE)
|
add_library(asio INTERFACE)
|
||||||
add_library(asio::asio ALIAS asio)
|
add_library(asio::asio ALIAS asio)
|
||||||
|
|
||||||
target_include_directories(asio INTERFACE $<BUILD_INTERFACE:${asio_SOURCE_DIR}/asio/include> $<INSTALL_INTERFACE:include/asio>)
|
target_include_directories(asio INTERFACE $<BUILD_INTERFACE:${asio_SOURCE_DIR}/asio/include> $<INSTALL_INTERFACE:include/asio>)
|
||||||
target_compile_definitions(asio INTERFACE ASIO_STANDALONE ASIO_NO_DEPRECATED)
|
target_compile_definitions(asio INTERFACE ASIO_STANDALONE ASIO_NO_DEPRECATED)
|
||||||
|
|
||||||
file(GLOB_RECURSE head_files ${asio_SOURCE_DIR}/asio/include/*.hpp ${asio_SOURCE_DIR}/asio/include/*.ipp)
|
file(GLOB_RECURSE head_files ${asio_SOURCE_DIR}/asio/include/*.hpp ${asio_SOURCE_DIR}/asio/include/*.ipp)
|
||||||
target_sources(asio INTERFACE FILE_SET HEADERS BASE_DIRS ${asio_SOURCE_DIR}/asio/include FILES ${head_files})
|
target_sources(asio INTERFACE FILE_SET HEADERS BASE_DIRS ${asio_SOURCE_DIR}/asio/include FILES ${head_files})
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(asio INTERFACE Threads::Threads)
|
target_link_libraries(asio INTERFACE Threads::Threads)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# macro see @ https://stackoverflow.com/a/40217291/1746503
|
# macro see @ https://stackoverflow.com/a/40217291/1746503
|
||||||
macro(get_win32_winnt version)
|
macro(get_win32_winnt version)
|
||||||
if(CMAKE_SYSTEM_VERSION)
|
if(CMAKE_SYSTEM_VERSION)
|
||||||
set(ver ${CMAKE_SYSTEM_VERSION})
|
set(ver ${CMAKE_SYSTEM_VERSION})
|
||||||
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
|
string(REGEX MATCH "^([0-9]+).([0-9])" ver ${ver})
|
||||||
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
|
string(REGEX MATCH "^([0-9]+)" verMajor ${ver})
|
||||||
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
|
# Check for Windows 10, b/c we'll need to convert to hex 'A'.
|
||||||
if("${verMajor}" MATCHES "10")
|
if("${verMajor}" MATCHES "10")
|
||||||
set(verMajor "A")
|
set(verMajor "A")
|
||||||
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
|
string(REGEX REPLACE "^([0-9]+)" ${verMajor} ver ${ver})
|
||||||
endif("${verMajor}" MATCHES "10")
|
endif("${verMajor}" MATCHES "10")
|
||||||
# Remove all remaining '.' characters.
|
# Remove all remaining '.' characters.
|
||||||
string(REPLACE "." "" ver ${ver})
|
string(REPLACE "." "" ver ${ver})
|
||||||
# Prepend each digit with a zero.
|
# Prepend each digit with a zero.
|
||||||
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
|
string(REGEX REPLACE "([0-9A-Z])" "0\\1" ver ${ver})
|
||||||
set(${version} "0x${ver}")
|
set(${version} "0x${ver}")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
if(NOT DEFINED _WIN32_WINNT)
|
||||||
|
get_win32_winnt(ver)
|
||||||
|
set(_WIN32_WINNT ${ver})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
|
||||||
|
|
||||||
if(NOT DEFINED _WIN32_WINNT)
|
message(STATUS "Set _WIN32_WINNET=${_WIN32_WINNT}")
|
||||||
get_win32_winnt(ver)
|
|
||||||
set(_WIN32_WINNT ${ver})
|
target_compile_definitions(asio INTERFACE _WIN32_WINNT=${_WIN32_WINNT} WIN32_LEAN_AND_MEAN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Set _WIN32_WINNET=${_WIN32_WINNT}")
|
set_property(TARGET asio PROPERTY EXPORT_NAME asio::asio)
|
||||||
|
install(
|
||||||
|
TARGETS asio
|
||||||
|
EXPORT asio-config
|
||||||
|
FILE_SET HEADERS
|
||||||
|
DESTINATION include/asio)
|
||||||
|
|
||||||
target_compile_definitions(asio INTERFACE _WIN32_WINNT=${_WIN32_WINNT} WIN32_LEAN_AND_MEAN)
|
install(EXPORT asio-config DESTINATION lib/cmake/asio)
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
set_property(TARGET asio PROPERTY EXPORT_NAME asio::asio)
|
get_asio()
|
||||||
install(
|
|
||||||
TARGETS asio
|
|
||||||
EXPORT asio-config
|
|
||||||
FILE_SET HEADERS
|
|
||||||
DESTINATION include/asio)
|
|
||||||
|
|
||||||
install(EXPORT asio-config DESTINATION lib/cmake/asio)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# asio::asio
|
# asio::asio
|
||||||
|
@ -22,13 +22,16 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(boost)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT boost_POPULATED)
|
function(get_boost)
|
||||||
set(BOOST_INCLUDE_LIBRARIES asio beast)
|
FetchContent_GetProperties(boost)
|
||||||
|
if(NOT boost_POPULATED)
|
||||||
|
set(BOOST_INCLUDE_LIBRARIES asio beast)
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
ON
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(boost)
|
FetchContent_MakeAvailable(boost)
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_boost()
|
||||||
|
@ -23,27 +23,32 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(cpptoml)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT cpptoml_POPULATED)
|
function(get_cpptoml)
|
||||||
FetchContent_Populate(cpptoml)
|
FetchContent_GetProperties(cpptoml)
|
||||||
|
if(NOT cpptoml_POPULATED)
|
||||||
|
FetchContent_Populate(cpptoml)
|
||||||
|
|
||||||
file(READ ${cpptoml_SOURCE_DIR}/include/cpptoml.h CPPTOML_TMP_VAR)
|
file(READ ${cpptoml_SOURCE_DIR}/include/cpptoml.h CPPTOML_TMP_VAR)
|
||||||
string(REPLACE "#include <cstring>" "#include <limits>" CPPTOML_TMP_VAR "${CPPTOML_TMP_VAR}")
|
string(REPLACE "#include <cstring>" "#include <limits>" CPPTOML_TMP_VAR "${CPPTOML_TMP_VAR}")
|
||||||
file(WRITE ${cpptoml_SOURCE_DIR}/include/cpptoml.h "${CPPTOML_TMP_VAR}")
|
file(WRITE ${cpptoml_SOURCE_DIR}/include/cpptoml.h "${CPPTOML_TMP_VAR}")
|
||||||
|
|
||||||
|
file(READ ${cpptoml_SOURCE_DIR}/cmake/cpptomlConfig.cmake.in CPPTOML_TMP_VAR)
|
||||||
|
string(REPLACE "\n" ";" CPPTOML_TMP_VAR_LINES "${CPPTOML_TMP_VAR}")
|
||||||
|
list(LENGTH CPPTOML_TMP_VAR_LINES CPPTOML_TMP_VAR_LINES_LENGTH)
|
||||||
|
if(CPPTOML_TMP_VAR_LINES_LENGTH GREATER 1)
|
||||||
|
list(REMOVE_AT CPPTOML_TMP_VAR_LINES 0)
|
||||||
|
endif()
|
||||||
|
string(REPLACE ";" "\n" CPPTOML_TMP_VAR_LINES "${CPPTOML_TMP_VAR_LINES}")
|
||||||
|
file(WRITE ${cpptoml_SOURCE_DIR}/cmake/cpptomlConfig.cmake.in "${CPPTOML_TMP_VAR_LINES}")
|
||||||
|
|
||||||
|
file(READ ${cpptoml_SOURCE_DIR}/CMakeLists.txt CPPTOML_TMP_VAR)
|
||||||
|
string(REPLACE " ON" " OFF" CPPTOML_TMP_VAR "${CPPTOML_TMP_VAR}")
|
||||||
|
file(WRITE ${cpptoml_SOURCE_DIR}/CMakeLists.txt "${CPPTOML_TMP_VAR}")
|
||||||
|
|
||||||
|
add_subdirectory(${cpptoml_SOURCE_DIR} ${cpptoml_BINARY_DIR})
|
||||||
|
|
||||||
file(READ ${cpptoml_SOURCE_DIR}/cmake/cpptomlConfig.cmake.in CPPTOML_TMP_VAR)
|
|
||||||
string(REPLACE "\n" ";" CPPTOML_TMP_VAR_LINES "${CPPTOML_TMP_VAR}")
|
|
||||||
list(LENGTH CPPTOML_TMP_VAR_LINES CPPTOML_TMP_VAR_LINES_LENGTH)
|
|
||||||
if(CPPTOML_TMP_VAR_LINES_LENGTH GREATER 1)
|
|
||||||
list(REMOVE_AT CPPTOML_TMP_VAR_LINES 0)
|
|
||||||
endif()
|
endif()
|
||||||
string(REPLACE ";" "\n" CPPTOML_TMP_VAR_LINES "${CPPTOML_TMP_VAR_LINES}")
|
endfunction()
|
||||||
file(WRITE ${cpptoml_SOURCE_DIR}/cmake/cpptomlConfig.cmake.in "${CPPTOML_TMP_VAR_LINES}")
|
|
||||||
|
|
||||||
file(READ ${cpptoml_SOURCE_DIR}/CMakeLists.txt CPPTOML_TMP_VAR)
|
get_cpptoml()
|
||||||
string(REPLACE " ON" " OFF" CPPTOML_TMP_VAR "${CPPTOML_TMP_VAR}")
|
|
||||||
file(WRITE ${cpptoml_SOURCE_DIR}/CMakeLists.txt "${CPPTOML_TMP_VAR}")
|
|
||||||
|
|
||||||
add_subdirectory(${cpptoml_SOURCE_DIR} ${cpptoml_BINARY_DIR})
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
@ -22,17 +22,19 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(fmt)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT fmt_POPULATED)
|
function(get_fmt)
|
||||||
set(FMT_MASTER_PROJECT
|
FetchContent_GetProperties(fmt)
|
||||||
OFF
|
if(NOT fmt_POPULATED)
|
||||||
CACHE BOOL "")
|
set(FMT_MASTER_PROJECT OFF)
|
||||||
set(FMT_INSTALL
|
|
||||||
${AIMRT_INSTALL}
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(fmt)
|
set(FMT_INSTALL ON)
|
||||||
endif()
|
|
||||||
|
FetchContent_MakeAvailable(fmt)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_fmt()
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# fmt::fmt
|
# fmt::fmt
|
||||||
|
@ -22,21 +22,24 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(gflags)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT gflags_POPULATED)
|
function(get_gflags)
|
||||||
FetchContent_Populate(gflags)
|
FetchContent_GetProperties(gflags)
|
||||||
|
if(NOT gflags_POPULATED)
|
||||||
|
FetchContent_Populate(gflags)
|
||||||
|
|
||||||
set(BUILD_TESTING
|
set(BUILD_TESTING OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
file(READ ${gflags_SOURCE_DIR}/CMakeLists.txt TMP_VAR)
|
file(READ ${gflags_SOURCE_DIR}/CMakeLists.txt TMP_VAR)
|
||||||
string(REPLACE " set (PKGCONFIG_INSTALL_DIR " "# set (PKGCONFIG_INSTALL_DIR " TMP_VAR "${TMP_VAR}")
|
string(REPLACE " set (PKGCONFIG_INSTALL_DIR " "# set (PKGCONFIG_INSTALL_DIR " TMP_VAR "${TMP_VAR}")
|
||||||
file(WRITE ${gflags_SOURCE_DIR}/CMakeLists.txt "${TMP_VAR}")
|
file(WRITE ${gflags_SOURCE_DIR}/CMakeLists.txt "${TMP_VAR}")
|
||||||
|
|
||||||
add_subdirectory(${gflags_SOURCE_DIR} ${gflags_BINARY_DIR})
|
add_subdirectory(${gflags_SOURCE_DIR} ${gflags_BINARY_DIR})
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_gflags()
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# gflags::gflags
|
# gflags::gflags
|
||||||
|
@ -22,19 +22,20 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(googletest)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT googletest_POPULATED)
|
function(get_googletest)
|
||||||
if(WIN32)
|
FetchContent_GetProperties(googletest)
|
||||||
set(gtest_force_shared_crt
|
if(NOT googletest_POPULATED)
|
||||||
ON
|
if(WIN32)
|
||||||
CACHE BOOL "")
|
set(gtest_force_shared_crt ON)
|
||||||
endif()
|
endif()
|
||||||
set(INSTALL_GTEST
|
set(INSTALL_GTEST OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(googletest)
|
FetchContent_MakeAvailable(googletest)
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_googletest()
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# GTest::gtest
|
# GTest::gtest
|
||||||
|
@ -25,12 +25,17 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(iceoryx)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT iceoryx_POPULATED)
|
function(get_iceoryx)
|
||||||
|
FetchContent_GetProperties(iceoryx)
|
||||||
|
if(NOT iceoryx_POPULATED)
|
||||||
|
|
||||||
FetchContent_Populate(iceoryx)
|
FetchContent_Populate(iceoryx)
|
||||||
|
|
||||||
# iceoryx‘s cmake file in ./iceoryx_meta
|
# iceoryx‘s cmake file in ./iceoryx_meta
|
||||||
add_subdirectory(${iceoryx_SOURCE_DIR}/iceoryx_meta ${iceoryx_BINARY_DIR})
|
add_subdirectory(${iceoryx_SOURCE_DIR}/iceoryx_meta ${iceoryx_BINARY_DIR})
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_iceoryx()
|
||||||
|
@ -22,43 +22,35 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(jsoncpp)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT jsoncpp_POPULATED)
|
function(get_jsoncpp)
|
||||||
set(JSONCPP_WITH_TESTS
|
FetchContent_GetProperties(jsoncpp)
|
||||||
OFF
|
if(NOT jsoncpp_POPULATED)
|
||||||
CACHE BOOL "")
|
set(JSONCPP_WITH_TESTS OFF)
|
||||||
set(JSONCPP_WITH_POST_BUILD_UNITTEST
|
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
set(BUILD_OBJECT_LIBS
|
set(JSONCPP_WITH_POST_BUILD_UNITTEST OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS)
|
set(BUILD_OBJECT_LIBS OFF)
|
||||||
set(BUILD_SHARED_LIBS
|
|
||||||
ON
|
if(BUILD_SHARED_LIBS)
|
||||||
CACHE BOOL "")
|
set(BUILD_SHARED_LIBS ON)
|
||||||
set(BUILD_STATIC_LIBS
|
set(BUILD_STATIC_LIBS OFF)
|
||||||
OFF
|
else()
|
||||||
CACHE BOOL "")
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
else()
|
set(BUILD_STATIC_LIBS ON)
|
||||||
set(BUILD_SHARED_LIBS
|
endif()
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
FetchContent_MakeAvailable(jsoncpp)
|
||||||
set(BUILD_STATIC_LIBS
|
|
||||||
ON
|
if(TARGET jsoncpp_static)
|
||||||
CACHE BOOL "")
|
add_library(jsoncpp::jsoncpp ALIAS jsoncpp_static)
|
||||||
|
elseif(TARGET jsoncpp_lib)
|
||||||
|
add_library(jsoncpp::jsoncpp ALIAS jsoncpp_lib)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
FetchContent_MakeAvailable(jsoncpp)
|
get_jsoncpp()
|
||||||
|
|
||||||
if(TARGET jsoncpp_static)
|
|
||||||
add_library(jsoncpp::jsoncpp ALIAS jsoncpp_static)
|
|
||||||
elseif(TARGET jsoncpp_lib)
|
|
||||||
add_library(jsoncpp::jsoncpp ALIAS jsoncpp_lib)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# jsoncpp::jsoncpp
|
# jsoncpp::jsoncpp
|
||||||
|
@ -22,20 +22,23 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(libunifex)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT libunifex_POPULATED)
|
function(get_libunifex)
|
||||||
set(UNIFEX_BUILD_EXAMPLES
|
FetchContent_GetProperties(libunifex)
|
||||||
OFF
|
if(NOT libunifex_POPULATED)
|
||||||
CACHE BOOL "")
|
set(UNIFEX_BUILD_EXAMPLES OFF)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(libunifex)
|
FetchContent_MakeAvailable(libunifex)
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||||
target_compile_options(unifex PRIVATE -Wno-unused-but-set-variable)
|
target_compile_options(unifex PRIVATE -Wno-unused-but-set-variable)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(unifex::unifex ALIAS unifex)
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
add_library(unifex::unifex ALIAS unifex)
|
get_libunifex()
|
||||||
endif()
|
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# unifex::unifex
|
# unifex::unifex
|
||||||
|
@ -22,22 +22,27 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(nghttp2)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT nghttp2_POPULATED)
|
function(get_nghttp2)
|
||||||
FetchContent_Populate(nghttp2)
|
FetchContent_GetProperties(nghttp2)
|
||||||
|
if(NOT nghttp2_POPULATED)
|
||||||
|
FetchContent_Populate(nghttp2)
|
||||||
|
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
set(BUILD_STATIC_LIBS ON)
|
set(BUILD_STATIC_LIBS ON)
|
||||||
set(ENABLE_LIB_ONLY ON)
|
set(ENABLE_LIB_ONLY ON)
|
||||||
|
|
||||||
# Avoid name conflict
|
# Avoid name conflict
|
||||||
set(nghttp2_CMAKE_FILE "${nghttp2_SOURCE_DIR}/CMakeLists.txt")
|
set(nghttp2_CMAKE_FILE "${nghttp2_SOURCE_DIR}/CMakeLists.txt")
|
||||||
file(READ ${nghttp2_CMAKE_FILE} CONTENTS)
|
file(READ ${nghttp2_CMAKE_FILE} CONTENTS)
|
||||||
string(REPLACE "add_custom_target(check COMMAND \${CMAKE_CTEST_COMMAND})" "" NEW_CONTENTS "${CONTENTS}")
|
string(REPLACE "add_custom_target(check COMMAND \${CMAKE_CTEST_COMMAND})" "" NEW_CONTENTS "${CONTENTS}")
|
||||||
file(WRITE ${nghttp2_CMAKE_FILE} "${NEW_CONTENTS}")
|
file(WRITE ${nghttp2_CMAKE_FILE} "${NEW_CONTENTS}")
|
||||||
|
|
||||||
add_subdirectory(${nghttp2_SOURCE_DIR} ${nghttp2_BINARY_DIR} EXCLUDE_FROM_ALL)
|
add_subdirectory(${nghttp2_SOURCE_DIR} ${nghttp2_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_nghttp2()
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# nghttp2::nghttp2
|
# nghttp2::nghttp2
|
||||||
|
@ -22,10 +22,15 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(nlohmann_json)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT nlohmann_json_POPULATED)
|
function(get_nlohmann_json)
|
||||||
FetchContent_MakeAvailable(nlohmann_json)
|
FetchContent_GetProperties(nlohmann_json)
|
||||||
endif()
|
if(NOT nlohmann_json_POPULATED)
|
||||||
|
FetchContent_MakeAvailable(nlohmann_json)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_nlohmann_json()
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# nlohmann_json::nlohmann_json
|
# nlohmann_json::nlohmann_json
|
||||||
|
@ -18,123 +18,110 @@ else()
|
|||||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
|
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(opentelemetry_cpp)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT opentelemetry_cpp_POPULATED)
|
function(get_opentelemetry_cpp)
|
||||||
set(BUILD_TESTING
|
FetchContent_GetProperties(opentelemetry_cpp)
|
||||||
OFF
|
if(NOT opentelemetry_cpp_POPULATED)
|
||||||
CACHE BOOL "")
|
set(BUILD_TESTING OFF)
|
||||||
|
|
||||||
set(WITH_BENCHMARK
|
set(WITH_BENCHMARK OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
set(WITH_EXAMPLES
|
set(WITH_EXAMPLES OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
set(WITH_FUNC_TESTS
|
set(WITH_FUNC_TESTS OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
set(WITH_NO_DEPRECATED_CODE
|
set(WITH_NO_DEPRECATED_CODE ON)
|
||||||
ON
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
set(WITH_DEPRECATED_SDK_FACTORY
|
set(WITH_DEPRECATED_SDK_FACTORY OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
set(WITH_OTLP_HTTP
|
set(WITH_OTLP_HTTP ON)
|
||||||
ON
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
set(WITH_STL
|
set(WITH_STL
|
||||||
"CXX20"
|
"CXX20"
|
||||||
CACHE STRING "")
|
CACHE STRING "")
|
||||||
|
|
||||||
set(OTELCPP_PROTO_PATH
|
set(OTELCPP_PROTO_PATH
|
||||||
${opentelemetry_proto_SOURCE_DIR}
|
${opentelemetry_proto_SOURCE_DIR}
|
||||||
CACHE PATH "")
|
CACHE PATH "")
|
||||||
|
|
||||||
set(PROTOBUF_PROTOC_EXECUTABLE
|
set(PROTOBUF_PROTOC_EXECUTABLE ${Protobuf_PROTOC_EXECUTABLE})
|
||||||
${Protobuf_PROTOC_EXECUTABLE}
|
|
||||||
CACHE STRING "")
|
|
||||||
|
|
||||||
set(BUILD_SHARED_LIBS
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(opentelemetry_cpp)
|
FetchContent_MakeAvailable(opentelemetry_cpp)
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_api)
|
||||||
|
add_library(opentelemetry-cpp::api ALIAS opentelemetry_api)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_sdk)
|
||||||
|
add_library(opentelemetry-cpp::sdk ALIAS opentelemetry_sdk)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_ext)
|
||||||
|
add_library(opentelemetry-cpp::ext ALIAS opentelemetry_ext)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_version)
|
||||||
|
add_library(opentelemetry-cpp::version ALIAS opentelemetry_version)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_common)
|
||||||
|
add_library(opentelemetry-cpp::common ALIAS opentelemetry_common)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_trace)
|
||||||
|
add_library(opentelemetry-cpp::trace ALIAS opentelemetry_trace)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_metrics)
|
||||||
|
add_library(opentelemetry-cpp::metrics ALIAS opentelemetry_metrics)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_logs)
|
||||||
|
add_library(opentelemetry-cpp::logs ALIAS opentelemetry_logs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_exporter_ostream_span)
|
||||||
|
add_library(opentelemetry-cpp::ostream_span_exporter ALIAS opentelemetry_exporter_ostream_span)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_exporter_ostream_metrics)
|
||||||
|
add_library(opentelemetry-cpp::ostream_metrics_exporter ALIAS opentelemetry_exporter_ostream_metrics)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_exporter_ostream_logs)
|
||||||
|
add_library(opentelemetry-cpp::ostream_log_record_exporter ALIAS opentelemetry_exporter_ostream_logs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_otlp_recordable)
|
||||||
|
add_library(opentelemetry-cpp::otlp_recordable ALIAS opentelemetry_otlp_recordable)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_exporter_otlp_http_client)
|
||||||
|
add_library(opentelemetry-cpp::otlp_http_client ALIAS opentelemetry_exporter_otlp_http_client)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_exporter_otlp_http)
|
||||||
|
add_library(opentelemetry-cpp::otlp_http_exporter ALIAS opentelemetry_exporter_otlp_http)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_exporter_otlp_http_log)
|
||||||
|
add_library(opentelemetry-cpp::otlp_http_log_record_exporter ALIAS opentelemetry_exporter_otlp_http_log)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_exporter_otlp_http_metric)
|
||||||
|
add_library(opentelemetry-cpp::otlp_http_metric_exporter ALIAS opentelemetry_exporter_otlp_http_metric)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TARGET opentelemetry_http_client_curl)
|
||||||
|
add_library(opentelemetry-cpp::http_client_curl ALIAS opentelemetry_http_client_curl)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(TARGET opentelemetry_api)
|
|
||||||
add_library(opentelemetry-cpp::api ALIAS opentelemetry_api)
|
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
if(TARGET opentelemetry_sdk)
|
get_opentelemetry_cpp()
|
||||||
add_library(opentelemetry-cpp::sdk ALIAS opentelemetry_sdk)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_ext)
|
|
||||||
add_library(opentelemetry-cpp::ext ALIAS opentelemetry_ext)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_version)
|
|
||||||
add_library(opentelemetry-cpp::version ALIAS opentelemetry_version)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_common)
|
|
||||||
add_library(opentelemetry-cpp::common ALIAS opentelemetry_common)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_trace)
|
|
||||||
add_library(opentelemetry-cpp::trace ALIAS opentelemetry_trace)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_metrics)
|
|
||||||
add_library(opentelemetry-cpp::metrics ALIAS opentelemetry_metrics)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_logs)
|
|
||||||
add_library(opentelemetry-cpp::logs ALIAS opentelemetry_logs)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_exporter_ostream_span)
|
|
||||||
add_library(opentelemetry-cpp::ostream_span_exporter ALIAS opentelemetry_exporter_ostream_span)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_exporter_ostream_metrics)
|
|
||||||
add_library(opentelemetry-cpp::ostream_metrics_exporter ALIAS opentelemetry_exporter_ostream_metrics)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_exporter_ostream_logs)
|
|
||||||
add_library(opentelemetry-cpp::ostream_log_record_exporter ALIAS opentelemetry_exporter_ostream_logs)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_otlp_recordable)
|
|
||||||
add_library(opentelemetry-cpp::otlp_recordable ALIAS opentelemetry_otlp_recordable)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_exporter_otlp_http_client)
|
|
||||||
add_library(opentelemetry-cpp::otlp_http_client ALIAS opentelemetry_exporter_otlp_http_client)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_exporter_otlp_http)
|
|
||||||
add_library(opentelemetry-cpp::otlp_http_exporter ALIAS opentelemetry_exporter_otlp_http)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_exporter_otlp_http_log)
|
|
||||||
add_library(opentelemetry-cpp::otlp_http_log_record_exporter ALIAS opentelemetry_exporter_otlp_http_log)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_exporter_otlp_http_metric)
|
|
||||||
add_library(opentelemetry-cpp::otlp_http_metric_exporter ALIAS opentelemetry_exporter_otlp_http_metric)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(TARGET opentelemetry_http_client_curl)
|
|
||||||
add_library(opentelemetry-cpp::http_client_curl ALIAS opentelemetry_http_client_curl)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# opentelemetry-cpp::api
|
# opentelemetry-cpp::api
|
||||||
|
@ -22,35 +22,29 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(protobuf)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT protobuf_POPULATED)
|
function(get_protobuf)
|
||||||
set(protobuf_BUILD_TESTS
|
FetchContent_GetProperties(protobuf)
|
||||||
OFF
|
if(NOT protobuf_POPULATED)
|
||||||
CACHE BOOL "")
|
set(protobuf_BUILD_TESTS OFF)
|
||||||
set(protobuf_BUILD_CONFORMANCE
|
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
set(protobuf_BUILD_EXAMPLES
|
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
set(protobuf_DISABLE_RTTI
|
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
set(protobuf_WITH_ZLIB
|
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
set(protobuf_MSVC_STATIC_RUNTIME
|
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
set(protobuf_INSTALL
|
|
||||||
${AIMRT_INSTALL}
|
|
||||||
CACHE BOOL "")
|
|
||||||
set(protobuf_VERBOSE
|
|
||||||
ON
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(protobuf)
|
set(protobuf_BUILD_CONFORMANCE OFF)
|
||||||
endif()
|
|
||||||
|
set(protobuf_DISABLE_RTTI OFF)
|
||||||
|
|
||||||
|
set(protobuf_WITH_ZLIB OFF)
|
||||||
|
|
||||||
|
set(protobuf_MSVC_STATIC_RUNTIME OFF)
|
||||||
|
|
||||||
|
set(protobuf_INSTALL ${AIMRT_INSTALL})
|
||||||
|
|
||||||
|
set(protobuf_VERBOSE ON)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(protobuf)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_protobuf()
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# protobuf::libprotobuf
|
# protobuf::libprotobuf
|
||||||
|
@ -22,7 +22,12 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(pybind11)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT pybind11_POPULATED)
|
function(get_pybind11)
|
||||||
FetchContent_MakeAvailable(pybind11)
|
FetchContent_GetProperties(pybind11)
|
||||||
endif()
|
if(NOT pybind11_POPULATED)
|
||||||
|
FetchContent_MakeAvailable(pybind11)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_pybind11()
|
||||||
|
@ -23,24 +23,29 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(sqlite)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT sqlite_POPULATED)
|
function(get_sqlite)
|
||||||
FetchContent_Populate(sqlite)
|
FetchContent_GetProperties(sqlite)
|
||||||
|
if(NOT sqlite_POPULATED)
|
||||||
|
FetchContent_Populate(sqlite)
|
||||||
|
|
||||||
# sqlite lib
|
# sqlite lib
|
||||||
add_library(libsqlite)
|
add_library(libsqlite)
|
||||||
add_library(sqlite::libsqlite ALIAS libsqlite)
|
add_library(sqlite::libsqlite ALIAS libsqlite)
|
||||||
|
|
||||||
file(GLOB head_files ${sqlite_SOURCE_DIR}/*.h)
|
file(GLOB head_files ${sqlite_SOURCE_DIR}/*.h)
|
||||||
|
|
||||||
target_sources(libsqlite PRIVATE ${sqlite_SOURCE_DIR}/sqlite3.c)
|
target_sources(libsqlite PRIVATE ${sqlite_SOURCE_DIR}/sqlite3.c)
|
||||||
target_include_directories(libsqlite PUBLIC $<BUILD_INTERFACE:${sqlite_SOURCE_DIR}>)
|
target_include_directories(libsqlite PUBLIC $<BUILD_INTERFACE:${sqlite_SOURCE_DIR}>)
|
||||||
target_sources(libsqlite INTERFACE FILE_SET HEADERS BASE_DIRS ${sqlite_SOURCE_DIR} FILES ${head_files})
|
target_sources(libsqlite INTERFACE FILE_SET HEADERS BASE_DIRS ${sqlite_SOURCE_DIR} FILES ${head_files})
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
target_link_libraries(libsqlite PUBLIC pthread dl)
|
target_link_libraries(libsqlite PUBLIC pthread dl)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endfunction()
|
||||||
|
|
||||||
|
get_sqlite()
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# sqlite::libsqlite
|
# sqlite::libsqlite
|
||||||
|
@ -22,22 +22,19 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(stdexec)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT stdexec_POPULATED)
|
function(get_stdexec)
|
||||||
set(STDEXEC_ENABLE_IO_URING_TESTS
|
FetchContent_GetProperties(stdexec)
|
||||||
OFF
|
if(NOT stdexec_POPULATED)
|
||||||
CACHE BOOL "")
|
set(STDEXEC_ENABLE_IO_URING_TESTS OFF)
|
||||||
|
set(STDEXEC_BUILD_EXAMPLES OFF)
|
||||||
|
set(STDEXEC_BUILD_TESTS OFF)
|
||||||
|
|
||||||
set(STDEXEC_BUILD_EXAMPLES
|
FetchContent_MakeAvailable(stdexec)
|
||||||
OFF
|
endif()
|
||||||
CACHE BOOL "")
|
endfunction()
|
||||||
|
|
||||||
set(STDEXEC_BUILD_TESTS
|
get_stdexec()
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(stdexec)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# STDEXEC::stdexec
|
# STDEXEC::stdexec
|
||||||
|
@ -22,26 +22,23 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(tbb)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT tbb_POPULATED)
|
function(get_tbb)
|
||||||
set(TBB_TEST
|
FetchContent_GetProperties(tbb)
|
||||||
OFF
|
if(NOT tbb_POPULATED)
|
||||||
CACHE BOOL "")
|
set(TBB_TEST OFF)
|
||||||
|
|
||||||
set(TBB_DIR
|
set(TBB_DIR "")
|
||||||
""
|
|
||||||
CACHE STRING "" FORCE)
|
|
||||||
|
|
||||||
set(TBB_INSTALL
|
set(TBB_INSTALL ON)
|
||||||
ON
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
set(TBB_STRICT
|
set(TBB_STRICT OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
|
||||||
|
|
||||||
FetchContent_MakeAvailable(tbb)
|
FetchContent_MakeAvailable(tbb)
|
||||||
endif()
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_tbb()
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# TBB::tbb
|
# TBB::tbb
|
||||||
|
@ -22,28 +22,27 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(yaml-cpp)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT yaml-cpp_POPULATED)
|
function(get_yaml_cpp)
|
||||||
set(BUILD_TESTING
|
FetchContent_GetProperties(yaml-cpp)
|
||||||
OFF
|
if(NOT yaml-cpp_POPULATED)
|
||||||
CACHE BOOL "")
|
set(BUILD_TESTING OFF)
|
||||||
set(YAML_CPP_BUILD_TESTS
|
|
||||||
OFF
|
set(YAML_CPP_BUILD_TESTS OFF)
|
||||||
CACHE BOOL "")
|
|
||||||
set(YAML_CPP_BUILD_TOOLS
|
set(YAML_CPP_BUILD_TOOLS OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
set(YAML_CPP_INSTALL ON)
|
||||||
set(YAML_CPP_INSTALL
|
|
||||||
ON
|
set(YAML_CPP_FORMAT_SOURCE OFF)
|
||||||
CACHE BOOL "")
|
|
||||||
set(YAML_CPP_FORMAT_SOURCE
|
set(YAML_CPP_BUILD_CONTRIB OFF)
|
||||||
OFF
|
|
||||||
CACHE BOOL "")
|
FetchContent_MakeAvailable(yaml-cpp)
|
||||||
set(YAML_CPP_BUILD_CONTRIB
|
endif()
|
||||||
OFF
|
endfunction()
|
||||||
CACHE BOOL "")
|
|
||||||
FetchContent_MakeAvailable(yaml-cpp)
|
get_yaml_cpp()
|
||||||
endif()
|
|
||||||
|
|
||||||
# import targets:
|
# import targets:
|
||||||
# yaml-cpp::yaml-cpp
|
# yaml-cpp::yaml-cpp
|
||||||
|
@ -23,7 +23,12 @@ else()
|
|||||||
OVERRIDE_FIND_PACKAGE)
|
OVERRIDE_FIND_PACKAGE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_GetProperties(zenohc)
|
# Wrap it in a function to restrict the scope of the variables
|
||||||
if(NOT zenohc_POPULATED)
|
function(get_zenohc)
|
||||||
FetchContent_MakeAvailable(zenohc)
|
FetchContent_GetProperties(zenohc)
|
||||||
endif()
|
if(NOT zenohc_POPULATED)
|
||||||
|
FetchContent_MakeAvailable(zenohc)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
get_zenohc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user