Skip to content

Commit

Permalink
Support yaml-cpp >= 0.8.0 (#46)
Browse files Browse the repository at this point in the history
Signed-off-by: Silvio Traversaro <[email protected]>
  • Loading branch information
traversaro authored Feb 13, 2024
1 parent 4f17f41 commit 7693ad2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions yaml_cpp_vendor-extras.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ find_package(yaml-cpp REQUIRED)
set(yaml_cpp_vendor_LIBRARIES ${YAML_CPP_LIBRARIES})
set(yaml_cpp_vendor_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR})

list(APPEND yaml_cpp_vendor_TARGETS yaml-cpp)
if(WIN32)
# On Windows, yaml-cpp 0.7.0 requires that downstream consumers set YAML_CPP_DLL and
# not yaml_cpp_EXPORT in order to set dllimport properly.
# This behavior will likely change in future versions of yaml-cpp.
set_target_properties(yaml-cpp PROPERTIES INTERFACE_COMPILE_DEFINITIONS YAML_CPP_DLL)
# since yaml-cpp 0.8.0, yaml-cpp supports the yaml-cpp::yaml-cpp target
if(TARGET yaml-cpp::yaml-cpp)
list(APPEND yaml_cpp_vendor_TARGETS yaml-cpp::yaml-cpp)
else()
list(APPEND yaml_cpp_vendor_TARGETS yaml-cpp)
if(WIN32)
# On Windows, yaml-cpp 0.7.0 requires that downstream consumers set YAML_CPP_DLL and
# not yaml_cpp_EXPORT in order to set dllimport properly.
# This behavior will likely change in future versions of yaml-cpp.
set_target_properties(yaml-cpp PROPERTIES INTERFACE_COMPILE_DEFINITIONS YAML_CPP_DLL)
endif()
endif()

0 comments on commit 7693ad2

Please sign in to comment.