Closed copilot0058 closed 1 month ago
https://github.com/jbeder/yaml-cpp?tab=readme-ov-file#how-to-integrate-it-within-your-project-using-cmake
Q1. YAML_CPP_INCLUDE_DIR and YAML_CPP_LIBRARIES are ""?
YAML_CPP_INCLUDE_DIR
YAML_CPP_LIBRARIES
Q2. Why is it unnecessary to use target_include_directories(test ${YAML_CPP_INCLUDE_DIR})? only use target_link_libraries
Q3. I write a library with opencv and yaml-cpp and set this
# lib cmake target_link_libraries(YOUR_LIBRARY PRIVATE ${OpenCV_LIBS} yaml-cpp::yaml-cpp)
Now I want to use another program to call YOUR_LIBRARY
# new project cmake target_link_libraries(test PRIVATE YOUR_LIBRARY::YOUR_LIBRARY)
It show the
# on new project error 'yaml-cpp/yaml.h': No such file or directory
Until I only change yaml-cpp::yaml-cpp from PRIVATE to PUBLIC, it build successly.
only
# lib cmake target_link_libraries(YOUR_LIBRARY PRIVATE ${OpenCV_LIBS} PUBLIC yaml-cpp::yaml-cpp)
Why does it must be PUBLIC for yaml? But the opencv can PRIVATE.
I have no idea. I'd ask on Stack Overflow.
https://github.com/jbeder/yaml-cpp?tab=readme-ov-file#how-to-integrate-it-within-your-project-using-cmake
Q1.
YAML_CPP_INCLUDE_DIR
andYAML_CPP_LIBRARIES
are ""?Q2. Why is it unnecessary to use target_include_directories(test ${YAML_CPP_INCLUDE_DIR})? only use target_link_libraries
Q3. I write a library with opencv and yaml-cpp and set this
Now I want to use another program to call YOUR_LIBRARY
It show the
Until I
only
change yaml-cpp::yaml-cpp from PRIVATE to PUBLIC, it build successly.Why does it must be PUBLIC for yaml? But the opencv can PRIVATE.