Skip to content

Commit

Permalink
Upgrade to yaml-cpp 0.7.0
Browse files Browse the repository at this point in the history
This includes a fix for macOS/Linux where newer yaml-cpp
moved the cmake files from
$prefix/opt/yaml_cpp_vendor/lib/cmake/yaml-cpp into
$prefix/opt/yaml_cpp_vendor/share/cmake/yaml-cpp

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
clalancette committed Jan 27, 2022
1 parent 14b8539 commit 33edbf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
19 changes: 5 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ option(FORCE_BUILD_VENDOR_PKG

find_package(ament_cmake REQUIRED)

set(PACKAGE_VERSION "1.0.0")

macro(build_yaml_cpp)
set(extra_cmake_args)

Expand All @@ -24,9 +22,7 @@ macro(build_yaml_cpp)
list(APPEND extra_cmake_args "-DYAML_CPP_BUILD_TESTS=OFF")
list(APPEND extra_cmake_args "-DYAML_CPP_BUILD_TOOLS=OFF")
list(APPEND extra_cmake_args "-DYAML_CPP_BUILD_CONTRIB=OFF")
list(APPEND extra_cmake_args "-DBUILD_SHARED_LIBS=ON")
list(APPEND extra_cmake_args "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
list(APPEND extra_cmake_args "-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}")
list(APPEND extra_cmake_args "-DYAML_BUILD_SHARED_LIBS=ON")
list(APPEND extra_cmake_args "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

Expand All @@ -41,14 +37,9 @@ macro(build_yaml_cpp)
endif()

include(ExternalProject)
# This specific version (past the current latest release of 0.5.3) is required to make
# yaml-cpp relocatable, hopefully it is released again soon.
# See: https://github.com/jbeder/yaml-cpp/pull/538
# Latest release fails to compile on recent visual studio (VS2017 v15.8.1)
# See: https://github.com/jbeder/yaml-cpp/pull/597
ExternalProject_Add(yaml_cpp-0f9a586
URL https://github.com/jbeder/yaml-cpp/archive/0f9a586ca1dc29c2ecb8dd715a315b93e3f40f79.zip
URL_MD5 ec76c27ebd07d5178cbe85b773df8e62
ExternalProject_Add(yaml_cpp-0.7.0
URL https://github.com/jbeder/yaml-cpp/archive/yaml-cpp-0.7.0.tar.gz
URL_MD5 74d646a3cc1b5d519829441db96744f0
TIMEOUT 600
LOG_CONFIGURE ${should_log}
LOG_BUILD ${should_log}
Expand All @@ -71,7 +62,7 @@ endmacro()
# NO_CMAKE_PACKAGE_REGISTRY used to avoid finding the library downloaded in WORKSPACE B
# when building workspace A.
# This should only find a system installed yaml-cpp and thus the environment hook isn't needed.
find_package(yaml-cpp 0.6 QUIET NO_CMAKE_PACKAGE_REGISTRY)
find_package(yaml-cpp QUIET NO_CMAKE_PACKAGE_REGISTRY)
if(FORCE_BUILD_VENDOR_PKG OR NOT yaml-cpp_FOUND)
build_yaml_cpp()

Expand Down
2 changes: 1 addition & 1 deletion yaml_cpp_vendor-extras.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(NOT yaml-cpp_FOUND)
if(WIN32)
set(yaml-cpp_DIR "${@PROJECT_NAME@_DIR}/../../../opt/yaml_cpp_vendor/CMake")
else()
set(yaml-cpp_DIR "${@PROJECT_NAME@_DIR}/../../../opt/yaml_cpp_vendor/lib/cmake/yaml-cpp")
set(yaml-cpp_DIR "${@PROJECT_NAME@_DIR}/../../../opt/yaml_cpp_vendor/share/cmake/yaml-cpp")
endif()
message(STATUS "Setting yaml-cpp_DIR to: '${yaml-cpp_DIR}'")

Expand Down

0 comments on commit 33edbf9

Please sign in to comment.