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 35769f2 commit e62b1e5
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 @@ -271,6 +271,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/scripts/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 @@ -37,7 +37,7 @@ target_link_libraries(${target} PUBLIC

geant321
geant4vmc
yaml-cpp
${YAMLCPPLIB}

Core
${VMCLIB}
Expand Down

0 comments on commit e62b1e5

Please sign in to comment.