jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
4.91k stars 1.78k forks source link

Add Readme.md the use of yaml-cpp library as a git submodule in CMake project #1213

Closed shemeshg closed 3 months ago

shemeshg commented 10 months ago

I found it the easiest ways, might help others (especially with 0.8.0 not linked correctly when installed with homebrew and find_package on macos) .

Maybe it useful to add readme.md something like

In your project directory, run the following command to add the yaml-cpp repository as a submodule:

git submodule add https://github.com/jbeder/yaml-cpp.git

In your main CMakeLists.txt file, add the following line to include the yaml-cpp directory:

add_subdirectory(yaml-cpp)

In your target CMakeLists.txt file, link your target with the yaml-cpp library using:

target_link_libraries(your_target yaml-cpp)