Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the choice of compiler and target is passed to sub-projects. #17732

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ endif()

if(ENABLE_WEBRTC)
include(FetchContent)
include(NetdataFetchContentExtra)

# ignore debhelper
set(FETCHCONTENT_FULLY_DISCONNECTED Off)
Expand All @@ -277,6 +278,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()
Expand Down
14 changes: 14 additions & 0 deletions packaging/cmake/Modules/NetdataFetchContentExtra.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,17 @@ macro(FetchContent_MakeAvailable_NoInstall name)
add_subdirectory(${${name}_SOURCE_DIR} ${${name}_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endmacro()

# NETDATA_PROPAGATE_TOOLCHAIN_ARGS
#
# Defines a set of CMake flags to be passed to CMAKE_ARGS for
# FetchContent_Declare and ExternalProject_Add to ensure that toolchain
# configuration propagates correctly to sub-projects.
#
# This needs to be explicitly included for any sub-project that needs
# to be built for the target system.
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}")
1 change: 1 addition & 0 deletions packaging/cmake/Modules/NetdataJSONC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function(netdata_bundle_jsonc)
FetchContent_Declare(json-c
GIT_REPOSITORY https://github.com/json-c/json-c
GIT_TAG b4c371fa0cbc4dcbaccc359ce9e957a22988fb34 # json-c-0.17-20230812
CMAKE_ARGS ${NETDATA_CMAKE_PROPAGATE_TOOLCHAIN_ARGS}
)

FetchContent_MakeAvailable_NoInstall(json-c)
Expand Down
2 changes: 2 additions & 0 deletions packaging/cmake/Modules/NetdataProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function(netdata_bundle_protobuf)
FetchContent_Declare(absl
GIT_REPOSITORY https://github.com/abseil/abseil-cpp
GIT_TAG ${ABSL_TAG}
CMAKE_ARGS ${NETDATA_CMAKE_PROPAGATE_TOOLCHAIN_ARGS}
)
FetchContent_MakeAvailable_NoInstall(absl)
message(STATUS "Finished preparing bundled Abseil")
Expand All @@ -47,6 +48,7 @@ function(netdata_bundle_protobuf)
FetchContent_Declare(protobuf
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
GIT_TAG ${PROTOBUF_TAG}
CMAKE_ARGS ${NETDATA_CMAKE_PROPAGATE_TOOLCHAIN_ARGS}
)
FetchContent_MakeAvailable_NoInstall(protobuf)
message(STATUS "Finished preparing bundled Protobuf.")
Expand Down
1 change: 1 addition & 0 deletions packaging/cmake/Modules/NetdataSentry.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function(netdata_bundle_sentry)
sentry
GIT_REPOSITORY https://github.com/getsentry/sentry-native.git
GIT_TAG c97bcc63fa89ae557cef9c9b6e3acb11a72ff97d # v0.6.6
CMAKE_ARGS ${NETDATA_CMAKE_PROPAGATE_TOOLCHAIN_ARGS}
)
FetchContent_MakeAvailable(sentry)
endfunction()
1 change: 1 addition & 0 deletions packaging/cmake/Modules/NetdataYAML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function(netdata_bundle_libyaml)
FetchContent_Declare(yaml
GIT_REPOSITORY https://github.com/yaml/libyaml
GIT_TAG 2c891fc7a770e8ba2fec34fc6b545c672beb37e6 # v0.2.5
CMAKE_ARGS ${NETDATA_CMAKE_PROPAGATE_TOOLCHAIN_ARGS}
)

FetchContent_MakeAvailable_NoInstall(yaml)
Expand Down
Loading