diff options
Diffstat (limited to 'packaging/cmake/Modules/NetdataYAML.cmake')
-rw-r--r-- | packaging/cmake/Modules/NetdataYAML.cmake | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/packaging/cmake/Modules/NetdataYAML.cmake b/packaging/cmake/Modules/NetdataYAML.cmake index 73af55167..f2f9b404e 100644 --- a/packaging/cmake/Modules/NetdataYAML.cmake +++ b/packaging/cmake/Modules/NetdataYAML.cmake @@ -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) @@ -44,6 +45,7 @@ macro(netdata_detect_libyaml) if(ENABLE_BUNDLED_LIBYAML OR NOT YAML_FOUND) netdata_bundle_libyaml() + set(ENABLE_BUNDLED_LIBYAML True PARENT_SCOPE) set(NETDATA_YAML_LDFLAGS yaml) get_target_property(NETDATA_YAML_INCLUDE_DIRS yaml INTERFACE_INCLUDE_DIRECTORIES) get_target_property(NETDATA_YAML_CFLAGS_OTHER yaml INTERFACE_COMPILE_DEFINITIONS) @@ -59,7 +61,11 @@ endmacro() # The specified target must already exist, and the netdata_detect_libyaml # macro must have already been run at least once for this to work correctly. function(netdata_add_libyaml_to_target _target) - target_include_directories(${_target} PUBLIC ${NETDATA_YAML_INCLUDE_DIRS}) - target_compile_definitions(${_target} PUBLIC ${NETDATA_YAML_CFLAGS_OTHER}) + if(ENABLE_BUNDLED_LIBYAML) + target_include_directories(${_target} BEFORE PUBLIC ${NETDATA_YAML_INCLUDE_DIRS}) + else() + target_include_directories(${_target} PUBLIC ${NETDATA_YAML_INCLUDE_DIRS}) + endif() + target_compile_options(${_target} PUBLIC ${NETDATA_YAML_CFLAGS_OTHER}) target_link_libraries(${_target} PUBLIC ${NETDATA_YAML_LDFLAGS}) endfunction() |