diff --git a/CMakeLists.txt b/CMakeLists.txt index d7009dcb..674dc521 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,11 @@ add_project_dependency(SpaceVecAlg REQUIRED NO_MODULE) if(BUILD_RBDYN_PARSERS) add_project_dependency(yaml-cpp 0.5.0 REQUIRED NO_MODULE) + if(TARGET yaml-cpp::yaml-cpp) + set(YAML_CPP_TARGET yaml-cpp::yaml-cpp) + else() + set(YAML_CPP_TARGET yaml-cpp) + endif() find_package(tinyxml2 QUIET NO_MODULE) if(NOT ${tinyxml2_FOUND}) diff --git a/binding/python/CMakeLists.txt b/binding/python/CMakeLists.txt index a8093bbe..c23f80b3 100644 --- a/binding/python/CMakeLists.txt +++ b/binding/python/CMakeLists.txt @@ -18,7 +18,7 @@ if(${BUILD_RBDYN_PARSERS}) tests/test_rbdyn_parsers.py) list(APPEND RBDYN_BINDINGS_TARGETS RBDyn::Parsers) if(NOT BUILD_SHARED_LIBS) - list(APPEND RBDYN_BINDINGS_TARGETS yaml-cpp tinyxml2::tinyxml2) + list(APPEND RBDYN_BINDINGS_TARGETS ${YAML_CPP_TARGET} tinyxml2::tinyxml2) endif() endif() diff --git a/src/parsers/CMakeLists.txt b/src/parsers/CMakeLists.txt index e2103a91..9d1b3656 100644 --- a/src/parsers/CMakeLists.txt +++ b/src/parsers/CMakeLists.txt @@ -13,8 +13,8 @@ target_include_directories( PUBLIC $ $ $) -target_link_libraries(RBDynParsers PUBLIC RBDyn tinyxml2::tinyxml2 yaml-cpp - Boost::boost) +target_link_libraries(RBDynParsers PUBLIC RBDyn tinyxml2::tinyxml2 + ${YAML_CPP_TARGET} Boost::boost) if(BUILD_SHARED_LIBS) set_target_properties(RBDynParsers PROPERTIES COMPILE_FLAGS "-DRBDYN_PARSERS_EXPORTS")