diff options
Diffstat (limited to 'packaging/cmake/Modules/NetdataFetchContentExtra.cmake')
-rw-r--r-- | packaging/cmake/Modules/NetdataFetchContentExtra.cmake | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/packaging/cmake/Modules/NetdataFetchContentExtra.cmake b/packaging/cmake/Modules/NetdataFetchContentExtra.cmake index cc70448de..e82fe413b 100644 --- a/packaging/cmake/Modules/NetdataFetchContentExtra.cmake +++ b/packaging/cmake/Modules/NetdataFetchContentExtra.cmake @@ -18,11 +18,15 @@ macro(FetchContent_MakeAvailable_NoInstall name) include(FetchContent) - FetchContent_GetProperties(${name}) + if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28) + FetchContent_MakeAvailable(${name}) + else() + FetchContent_GetProperties(${name}) - if(NOT ${name}_POPULATED) - FetchContent_Populate(${name}) - add_subdirectory(${${name}_SOURCE_DIR} ${${name}_BINARY_DIR} EXCLUDE_FROM_ALL) + if(NOT ${name}_POPULATED) + FetchContent_Populate(${name}) + add_subdirectory(${${name}_SOURCE_DIR} ${${name}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() endif() endmacro() @@ -34,8 +38,17 @@ endmacro() # # This needs to be explicitly included for any sub-project that needs # to be built for the target system. +# +# This also needs to _NOT_ have any generator expressions, as they are not +# supported for the required usage of this variable in CMake 3.30 or newer. set(NETDATA_PROPAGATE_TOOLCHAIN_ARGS "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - $<$<BOOL:${CMAKE_C_COMPILER_TARGET}>:-DCMAKE_C_COMPILER_TARGET=${CMAKE_C_COMPILER_TARGET} - $<$<BOOL:${CMAKE_CXX_COMPILER_TARGET}>:-DCMAKE_CXX_COMPILER_TARGET=${CMAKE_CXX_COMPILER_TARGET}") + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}") + +if(DEFINED CMAKE_C_COMPILER_TARGET) + set(NETDATA_PROPAGATE_TOOLCHAIN_ARGS "${NETDATA_PROPAGATE_TOOLCHAIN_ARGS} -DCMAKE_C_COMPILER_TARGET=${CMAKE_C_COMPILER_TARGET}") +endif() + +if(DEFINED CMAKE_CXX_COMPILER_TARGET) + set(NETDATA_PROPAGATE_TOOLCHAIN_ARGS "${NETDATA_PROPAGATE_TOOLCHAIN_ARGS} -DCMAKE_CXX_COMPILER_TARGET=${CMAKE_CXX_COMPILER_TARGET}") +endif() |