From f2687ed1ff06493d79f87fafed7e137e0da00ca6 Mon Sep 17 00:00:00 2001 From: Pierre Wendling <50808272+FtZPetruska@users.noreply.github.com> Date: Fri, 18 Aug 2023 21:06:45 -0400 Subject: [PATCH] CMake: Add compatibility for yaml-cpp 0.8.0. (#1115) - Upstream uses YAML_CPP_INCLUDE_DIR - yaml-cpp 0.8.0 does not set YAML_CPP_LIBRARIES to the new target name. - Debug builds of yaml-cpp suffix the library with `d`. --- tools/EurocDataset/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/EurocDataset/CMakeLists.txt b/tools/EurocDataset/CMakeLists.txt index 4d0f04f1e2..6598decbdc 100644 --- a/tools/EurocDataset/CMakeLists.txt +++ b/tools/EurocDataset/CMakeLists.txt @@ -1,27 +1,31 @@ FIND_PACKAGE(yaml-cpp QUIET) -IF(NOT yaml-cpp_FOUND) +IF(yaml-cpp_FOUND) + # yaml-cpp 0.8.0 uses the wrong target in YAML_CPP_LIBRARIES. + IF(yaml-cpp_VERSION VERSION_EQUAL "0.8.0") + SET(YAML_CPP_LIBRARIES yaml-cpp::yaml-cpp) + ENDIF() +ELSE() find_package(PkgConfig QUIET) IF(PKG_CONFIG_FOUND) pkg_check_modules(yaml_cpp QUIET yaml-cpp) IF(yaml_cpp_FOUND) SET(YAML_CPP_LIBRARIES ${yaml_cpp_LIBRARIES}) - SET(YAML_CPP_INCLUDE_DIRS ${yaml_cpp_INCLUDEDIR}) + SET(YAML_CPP_INCLUDE_DIR ${yaml_cpp_INCLUDEDIR}) SET(yaml-cpp_FOUND ${yaml_cpp_FOUND}) ENDIF(yaml_cpp_FOUND) ENDIF(PKG_CONFIG_FOUND) -ENDIF(NOT yaml-cpp_FOUND) +ENDIF(yaml-cpp_FOUND) IF(yaml-cpp_FOUND) SET(INCLUDE_DIRS - ${YAML_CPP_INCLUDE_DIRS} + ${YAML_CPP_INCLUDE_DIR} ) SET(LIBRARIES ${YAML_CPP_LIBRARIES} - yaml-cpp ) INCLUDE_DIRECTORIES(${INCLUDE_DIRS} yaml-cpp)