diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2024-04-10 08:30:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-10 08:30:17 -0400 |
commit | 0f5b137471a7a2f56cb2700394b0cd198c8787e1 (patch) | |
tree | fd8c37e90f651b08ec14d3abb2ca26ed414b975b /CMakeLists.txt | |
parent | f2fa748edebb1c2dbc08868f5c7e0a3d12ae44c3 (diff) |
Move bundling of JSON-C to CMake. (#17207)
* Move bundling of JSON-C to CMake.
* Fix JSON-C build option passing.
* Force CMake policy 77 to new behavior for JSON-C build.
This is required to ensure that options we set are propagated correctly
into the sub-project.
* Fix include path selection and handling for bundled JSON-C.
* Fix include ordering again.
* Fixup JSON header compat link handling.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 88c664bed7..61bda3abcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,15 +271,17 @@ if(NOT HAVE_LOG10) endif() # -# Custom modules +# Custom Modules # +include(NetdataJSONC) include(NetdataYAML) # # Checks from custom modules # +netdata_detect_jsonc() netdata_detect_libyaml() # @@ -1511,23 +1513,7 @@ endif() # judy target_link_libraries(libnetdata PUBLIC judy) -# json-c -if(ENABLE_BUNDLED_JSONC) - add_library(jsonc STATIC IMPORTED) - set_property(TARGET jsonc PROPERTY - IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/externaldeps/jsonc/libjson-c.a") - - target_include_directories(libnetdata BEFORE PUBLIC "${CMAKE_SOURCE_DIR}/externaldeps/jsonc") - target_link_libraries(libnetdata PUBLIC jsonc) -else() - pkg_check_modules(JSONC REQUIRED json-c) - target_include_directories(libnetdata BEFORE PUBLIC ${JSONC_INCLUDE_DIRS}) - target_compile_definitions(libnetdata PUBLIC ${JSONC_CFLAGS_OTHER}) - target_link_libraries(libnetdata PUBLIC ${JSONC_LDFLAGS}) -endif() - -# message(FATAL_ERROR "jsonc libraries: ${JSONC_LIBRARIES}") -# message(FATAL_ERROR "jsonc ldflags: ${JSONC_LDFLAGS}") +netdata_add_jsonc_to_target(libnetdata) netdata_add_libyaml_to_target(libnetdata) |