From 17a9562b352f9a726188f570dec55e683a663c91 Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Tue, 18 Apr 2023 21:53:42 -0700 Subject: [PATCH] support system yaml-cpp (closes #12317) --- src/cpp/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 68e333af935..1518ca2a0e5 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -225,11 +225,17 @@ else() find_package(yaml-cpp REQUIRED) endif() -if(NOT EXISTS "${YAML_CPP_INCLUDE_DIR}") +if(yaml-cpp_FOUND AND NOT YAML_CPP_LIBRARIES) + set(YAML_CPP_LIBRARIES yaml-cpp) +endif() + +if(NOT RSTUDIO_USE_SYSTEM_YAML_CPP AND NOT EXISTS "${YAML_CPP_INCLUDE_DIR}") message(FATAL_ERROR "yaml-cpp not found (re-run dependencies script to install)") endif() -include_directories(SYSTEM "${YAML_CPP_INCLUDE_DIR}") +if(YAML_CPP_INCLUDE_DIR) + include_directories(SYSTEM "${YAML_CPP_INCLUDE_DIR}") +endif() # determine whether we should statically link boost. we always do this # unless we are building a non-packaged build on linux (in which case