Skip to content

Commit

Permalink
CMake: Add compatibility for yaml-cpp 0.8.0.
Browse files Browse the repository at this point in the history
- 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`.
  • Loading branch information
FtZPetruska committed Aug 17, 2023
1 parent cdd8cd9 commit 30d7738
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tools/EurocDataset/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 30d7738

Please sign in to comment.