summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAustin S. Hemmelgarn <austin@netdata.cloud>2024-05-24 07:13:25 -0400
committerGitHub <noreply@github.com>2024-05-24 14:13:25 +0300
commite81a8d826cbab4b74fbca5c16e2d4fe683cecbf6 (patch)
tree1fd424e5892a701e4d8ec04613025dcd7d255467 /CMakeLists.txt
parent66b6f334c41cb660bcd9e44e8392b57c8a07d218 (diff)
Ensure that the choice of compiler and target is passed to sub-projects. (#17732)
If not explicitly set using exported environment variables, the choice of compilers and compiler targets used by CMake does not get propagated to sub-porjects created with ExternalProject_Add or FetchContent_Declare. In most cases this does not matter, because very few people are building using non-default compilers for their environment, but it can cause issues in two specific cases: - If building for the same system that the build is happening on, but using a non-default compiler specified using CMake arguments (instead of via exported environment variables), sub-projects will still use the default compiler for the system, which may result in linking errors (or runtime failures even if the link succeeds). - If cross-compiling and not using the preferred approaches of either a toolchain file or exported environment variables, sub-projects may not even build for the correct CPU architecture, causing the build to fail. This adds logic to ensure that the compiler and compiler targets get propagated correctly even if they are just specified on the command line, thus avoiding the above two possibilities.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt2
1 files changed, 2 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a0c30570c8..65fdd3bdcf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -204,6 +204,7 @@ endif()
if(ENABLE_WEBRTC)
include(FetchContent)
+ include(NetdataFetchContentExtra)
# ignore debhelper
set(FETCHCONTENT_FULLY_DISCONNECTED Off)
@@ -217,6 +218,7 @@ if(ENABLE_WEBRTC)
FetchContent_Declare(libdatachannel
GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git
GIT_TAG v0.20.1
+ CMAKE_ARGS ${NETDATA_PROPAGATE_TOOLCHAIN_ARGS}
)
FetchContent_MakeAvailable(libdatachannel)
endif()