From 830196223a604f0bd0e466ad46cb8dddf97cfd42 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Tue, 25 Aug 2020 11:01:59 -0300 Subject: [PATCH 1/4] Revert "Revert "Use system installed yaml-cpp 0.6 if available (#8)" (#15)" This reverts commit 251be2773a0b6f46fa54583d7d05699c46183613. Signed-off-by: Ivan Santiago Paunovic --- CMakeLists.txt | 29 +++++++++++++++++------------ yaml_cpp_vendor-extras.cmake.in | 10 ++++------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ffee5f..8021af4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,22 +65,27 @@ macro(build_yaml_cpp) ) endmacro() -build_yaml_cpp() +find_package(yaml-cpp 0.6 QUIET) +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}") endif() -ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.dsv.in) ament_package( CONFIG_EXTRAS "yaml_cpp_vendor-extras.cmake.in" diff --git a/yaml_cpp_vendor-extras.cmake.in b/yaml_cpp_vendor-extras.cmake.in index 6141812..a09422d 100644 --- a/yaml_cpp_vendor-extras.cmake.in +++ b/yaml_cpp_vendor-extras.cmake.in @@ -1,8 +1,6 @@ -## 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") @@ -10,9 +8,9 @@ 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}) From ec8e73bdee824a4da1b2b4b614eb0744f7e91918 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Tue, 25 Aug 2020 11:06:39 -0300 Subject: [PATCH 2/4] Print location Signed-off-by: Ivan Santiago Paunovic --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8021af4..7a6ea01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,7 @@ if(NOT yaml-cpp_FOUND) endif() ament_environment_hooks(env_hook/yaml_cpp_vendor_library_path.dsv.in) else() - message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION}") + message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION} in path ${yaml-cpp_CONFIG}") endif() ament_package( From 46ede7b3f01b326b624b8e097b1165d01f8e7583 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Tue, 25 Aug 2020 17:49:01 -0300 Subject: [PATCH 3/4] Enable cmake find debug mode Signed-off-by: Ivan Santiago Paunovic --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a6ea01..3de5cb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,9 @@ macro(build_yaml_cpp) ) endmacro() +set(CMAKE_FIND_DEBUG_MODE TRUE) find_package(yaml-cpp 0.6 QUIET) +set(CMAKE_FIND_DEBUG_MODE FALSE) if(NOT yaml-cpp_FOUND) build_yaml_cpp() From 389e2f437a8110bbd717dbf207cd4a044c0f6b52 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Wed, 26 Aug 2020 14:13:59 -0300 Subject: [PATCH 4/4] Use NO_CMAKE_PACKAGE_REGISTRY Signed-off-by: Ivan Santiago Paunovic --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3de5cb6..b52d930 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,9 +65,10 @@ macro(build_yaml_cpp) ) endmacro() -set(CMAKE_FIND_DEBUG_MODE TRUE) -find_package(yaml-cpp 0.6 QUIET) -set(CMAKE_FIND_DEBUG_MODE FALSE) +# 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) if(NOT yaml-cpp_FOUND) build_yaml_cpp()