diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-21 17:19:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-21 17:19:04 +0000 |
commit | 310edf444908b09ea6d00c03baceb7925f3bb7a2 (patch) | |
tree | 7064577c7fa7a851e2e930beb606ea8237b0bbd2 /packaging/cmake/Modules/NetdataFetchContentExtra.cmake | |
parent | Releasing debian version 1.44.3-2. (diff) | |
download | netdata-310edf444908b09ea6d00c03baceb7925f3bb7a2.tar.xz netdata-310edf444908b09ea6d00c03baceb7925f3bb7a2.zip |
Merging upstream version 1.45.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/cmake/Modules/NetdataFetchContentExtra.cmake')
-rw-r--r-- | packaging/cmake/Modules/NetdataFetchContentExtra.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packaging/cmake/Modules/NetdataFetchContentExtra.cmake b/packaging/cmake/Modules/NetdataFetchContentExtra.cmake new file mode 100644 index 000000000..1de1dcef9 --- /dev/null +++ b/packaging/cmake/Modules/NetdataFetchContentExtra.cmake @@ -0,0 +1,27 @@ +# Extra tools for working with FetchContent on older CMake +# +# Copyright (c) 2024 Netdata Inc. +# SPDX-License-Identifier: GPL-3.0-or-later + +# FetchContent_MakeAvailable_NoInstall +# +# Add a sub-project with FetchContent, but with the EXCLUDE_FROM_ALL +# argument for the add_subdirectory part. +# +# CMake 3.28 and newer provide a way to do this with an extra argument +# on FetchContent_Declare, but older versions need you to implement +# the logic yourself. Once we no longer support CMake versions older +# than 3.28, we can get rid of this macro. +# +# Unlike FetchContent_MakeAvailble, this only accepts a single project +# to make available. +macro(FetchContent_MakeAvailable_NoInstall name) + include(FetchContent) + + FetchContent_GetProperties(${name}) + + if(NOT ${name}_POPULATED) + FetchContent_Populate(${name}) + add_subdirectory(${${name}_SOURCE_DIR} ${${name}_BINARY_DIR} EXCLUDE_FROM_ALL) + endif() +endmacro() |