Commit 39f00692 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/yaml-cpp-fix-dependency' into integration_2024_w43 (!3063)

Update yaml-cpp dependency handling

- Added CPM fallback in case package is not found automatically.
- Using yaml-cpp::yaml-cpp target instead of yaml-cpp to silence
  deprecation warnings on newer cmake versions.
parents 7b2e4a8c d8d11d36
......@@ -32,7 +32,7 @@ set (OPENAIR_DIR ${CMAKE_SOURCE_DIR})
include("cmake_targets/macros.cmake")
if(NOT DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_SOURCE_CACHE ~/.cache/cpm/)
set(CPM_SOURCE_CACHE ~/.cache/cpm/ CACHE FILEPATH "Directory to download CPM dependencies")
endif()
include("cmake_targets/CPM.cmake")
......
find_package(yaml-cpp REQUIRED PATHS /usr/lib/aarch64-linux-gnu/pkgconfig/)
# include(FetchContent)
# FetchContent_Declare(
# yaml-cpp
# GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
# GIT_TAG 0.8.0
# )
# FetchContent_GetProperties(yaml-cpp)
# if(NOT yaml-cpp_POPULATED)
# message(STATUS "Fetching yaml-cpp...")
# FetchContent_Populate(yaml-cpp)
# add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR})
# endif()
find_package(yaml-cpp)
if (NOT yaml-cpp_FOUND)
CPMAddPackage("gh:jbeder/yaml-cpp#yaml-cpp-0.7.0@0.7.0")
else()
if (NOT TARGET yaml-cpp::yaml-cpp)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()
endif()
add_library(params_yaml_static config_yaml.cpp)
target_link_libraries(params_yaml_static PUBLIC UTIL yaml-cpp)
target_link_libraries(params_yaml_static PUBLIC UTIL yaml-cpp::yaml-cpp)
if (ENABLE_TESTS)
add_subdirectory(tests)
endif()
add_library(params_yaml MODULE config_yaml.cpp)
target_link_libraries(params_yaml PUBLIC UTIL yaml-cpp)
target_link_libraries(params_yaml PUBLIC UTIL yaml-cpp::yaml-cpp)
set_target_properties(params_yaml PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment