yaml-cpp: Cannot find headers (and libraries) as CMake variables are unset
Hello,
as per issue title, I’m having a problem when I try to use yaml-cpp in a project I’m working on. Namely, the compiler can’t find header files (but I suppose the same will go for libraries) when I try to compile.
This is due to the fact that the file used by CMake to set the paths of include and link directories does not set the proper values for the variables. The content of share/cmake/yaml-cpp/yaml-cpp-config.cmake after installation is;:
# - Config file for the yaml-cpp package
# It defines the following variables
# YAML_CPP_INCLUDE_DIR - include directory
# YAML_CPP_LIBRARIES - libraries to link against
# Compute paths
get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(YAML_CPP_INCLUDE_DIR "")
# Our library dependencies (contains definitions for IMPORTED targets)
include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
# These are IMPORTED targets created by yaml-cpp-targets.cmake
set(YAML_CPP_LIBRARIES "")
As you can see, the variables YAML_INCLUDE_DIR and YAML_CPP_LIBRARIES are empty. I believe the problem may lie in the input file yaml-cpp-config.cmake.in:
# - Config file for the yaml-cpp package
# It defines the following variables
# YAML_CPP_INCLUDE_DIR - include directory
# YAML_CPP_LIBRARIES - libraries to link against
# Compute paths
get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@")
# Our library dependencies (contains definitions for IMPORTED targets)
include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
# These are IMPORTED targets created by yaml-cpp-targets.cmake
set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@")
Indeed, grep-ing for CONFIG_INCLUDE_DIRS or EXPORT_TARGETS yields no results in the whole repository, so substitution should give an empty string.
Am I missing something?
Thanks!
mattia
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 9
- Comments: 21 (3 by maintainers)
Commits related to this issue
- yaml-cpp-config.cmake.in: apply patch to fix #774 From https://github.com/jbeder/yaml-cpp/issues/774#issuecomment-909274732 — committed to Artturin/yaml-cpp by Artturin 3 years ago
- fix cmake export After configure the file `yaml-cpp-config.cmake.in` the result ends up with empty variables. (see also the discussion in #774). Rework this file and the call to `configure_package_... — committed to felix2010/yaml-cpp by felix2010 3 years ago
- fix cmake export After configure the file `yaml-cpp-config.cmake.in` the result ends up with empty variables. (see also the discussion in #774). Rework this file and the call to `configure_package_... — committed to felix2010/yaml-cpp by felix2010 3 years ago
- fix cmake export After configure the file `yaml-cpp-config.cmake.in` the result ends up with empty variables. (see also the discussion in #774). Rework this file and the call to `configure_package_... — committed to felix2010/yaml-cpp by felix2010 3 years ago
- Fix CMake export files (#1077) After configuring the file `yaml-cpp-config.cmake.in`, the result ends up with empty variables. (see also the discussion in #774). Rework this file and the call to... — committed to jbeder/yaml-cpp by felix2010 2 years ago
- Downgrade dependency yaml-cpp version to 0.6.3 until fix for https://github.com/jbeder/yaml-cpp/issues/774 is released. — committed to flathub/net.sourceforge.GrandOrgue by lbssousa a year ago
- Fix CMake export files (#1077) After configuring the file `yaml-cpp-config.cmake.in`, the result ends up with empty variables. (see also the discussion in #774). Rework this file and the call to... — committed to davemccann/yaml-cpp by felix2010 2 years ago
My approach is to fix the issue by setting the environtment value and manually changing the cmake file
CMakeLists.txt
Same problem on debian bullseye with 0.7.0. In the meantime, I stick to using version 0.6.x from a debian package.
Also came across the smae issue, after running
make install, I found theyaml-cpp-config.cmakelike this"I don’t know why the
YAML_CPP_INCLUDE_DIRandYAML_CPP_LIBRARIESare empty.