CMake Build: Fix yaml-cpp include directory detection

On Ubuntu 19.10 the libyaml-cpp-dev CMake config module has a broken
value for YAML_CPP_INCLUDE_DIR.

Change-Id: I5097ef656b988dda0326a15b521b92cbbdb0a390
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Cristian Adam
2020-02-25 17:39:00 +01:00
parent da5d53b89b
commit 18386c7117

View File

@@ -10,6 +10,11 @@ find_package(yaml-cpp 0.5 QUIET NO_MODULE)
if (yaml-cpp_FOUND)
# target doesn't set include directory for some reason
get_filename_component(yaml_cpp_include_dir ${YAML_CPP_INCLUDE_DIR} ABSOLUTE)
if (NOT EXISTS yaml_cpp_include_dir)
unset(yaml_cpp_include_dir)
unset(yaml_cpp_include_dir CACHE)
find_path(yaml_cpp_include_dir yaml-cpp/yaml.h)
endif()
target_include_directories(yaml-cpp INTERFACE ${yaml_cpp_include_dir})
else()
set(yaml-cpp_FOUND 1)