Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reapply "Use system installed yaml-cpp 0.6 if available (#8)" #16

Merged
merged 4 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,30 @@ macro(build_yaml_cpp)
)
endmacro()

build_yaml_cpp()
# NO_CMAKE_PACKAGE_REGISTRY used to avoid finding the library downloaded in WORKSPACE B
# when building workspace A.
dirk-thomas marked this conversation as resolved.
Show resolved Hide resolved
# 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)
if(NOT yaml-cpp_FOUND)
build_yaml_cpp()

if(WIN32)
ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.bat)
set(ENV_VAR_NAME "PATH")
set(ENV_VAR_VALUE "opt\\yaml_cpp_vendor\\bin")
else()
ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.sh)
if(APPLE)
set(ENV_VAR_NAME "DYLD_LIBRARY_PATH")
if(WIN32)
ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.bat)
set(ENV_VAR_NAME "PATH")
set(ENV_VAR_VALUE "opt\\yaml_cpp_vendor\\bin")
else()
set(ENV_VAR_NAME "LD_LIBRARY_PATH")
ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.sh)
if(APPLE)
set(ENV_VAR_NAME "DYLD_LIBRARY_PATH")
else()
set(ENV_VAR_NAME "LD_LIBRARY_PATH")
endif()
set(ENV_VAR_VALUE "opt/yaml_cpp_vendor/lib")
endif()
set(ENV_VAR_VALUE "opt/yaml_cpp_vendor/lib")
ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.dsv.in)
else()
message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION} in path ${yaml-cpp_CONFIG}")
endif()
ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.dsv.in)

ament_package(
CONFIG_EXTRAS "yaml_cpp_vendor-extras.cmake.in"
Expand Down
10 changes: 4 additions & 6 deletions yaml_cpp_vendor-extras.cmake.in
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
## mjbogusz: find_package() and if() disabled until ament can handle complex paths resolving to /usr/include
## always use locally built yaml-cpp for now
# find_package(yaml-cpp QUIET)
find_package(yaml-cpp 0.6 QUIET)

# if(NOT yaml-cpp_FOUND)
if(NOT yaml-cpp_FOUND)
# add the local Modules directory to the modules path
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")
endif()
message(STATUS "Setting yaml-cpp_DIR to: '${yaml-cpp_DIR}'")
# endif()

find_package(yaml-cpp CONFIG REQUIRED QUIET)
find_package(yaml-cpp CONFIG REQUIRED QUIET)
endif()

set(yaml_cpp_vendor_LIBRARIES ${YAML_CPP_LIBRARIES})
set(yaml_cpp_vendor_INCLUDE_DIRS ${YAML_CPP_INCLUDE_DIR})
Expand Down