Skip to content

Commit

Permalink
build: Support yaml-cpp 0.8+
Browse files Browse the repository at this point in the history
Beginning from version 0.8.0 the exported target has been renamed to `yaml-cpp::yaml-cpp`.
To support also older versions choose the correct target name stored in a CMake variable.

(cherry-picked from commit 2af719f)
  • Loading branch information
fuhlig1 authored and ChristianTackeGSI committed Nov 16, 2023
1 parent 45f6e87 commit 52a8971
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,17 @@ if( yaml-cpp_FOUND
INTERFACE_INCLUDE_DIRECTORIES "${YAML_CPP_INCLUDE_DIR}"
)
endif()
# Workaround to fix a problem with the imported target name
# The target name includes the namespace yaml-cpp begining
# from version 0.8.0. So the new exported target is now
# yaml-cpp::yaml-cpp.
if(yaml-cpp_FOUND)
if(TARGET yaml-cpp::yaml-cpp)
set(YAMLCPPLIB yaml-cpp::yaml-cpp)
else()
set(YAMLCPPLIB yaml-cpp)
endif()
endif()

configure_file(${CMAKE_SOURCE_DIR}/cmake/private/FairRootConfigVersion.cmake.in "${CMAKE_BINARY_DIR}/FairRootConfigVersion.cmake" @ONLY)

Expand Down
2 changes: 1 addition & 1 deletion fairtools/MCConfigurator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ target_include_directories(${target} SYSTEM PUBLIC
target_link_libraries(${target}
PUBLIC
FairRoot::Base # FairGenericVMCConfig
yaml-cpp
${YAMLCPPLIB}

PRIVATE
FairRoot::Tools
Expand Down

0 comments on commit 52a8971

Please sign in to comment.