mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Add CMake integration example
This commit is contained in:

committed by
Jesse Beder

parent
94710bb221
commit
c28295bda4
21
README.md
21
README.md
@@ -49,6 +49,27 @@ cmake [-G generator] [-DYAML_BUILD_SHARED_LIBS=on|OFF] ..
|
||||
|
||||
**Note:** To clean up, just remove the `build` directory.
|
||||
|
||||
## How to Integrate it within your project using CMake
|
||||
|
||||
You can use for example FetchContent :
|
||||
|
||||
```cmake
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(yaml-cpp
|
||||
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
|
||||
GIT_TAG 1b50109f7bea60bd382d8ea7befce3d2bd67da5f) # The latest yaml-cpp commit at the time of writing.
|
||||
FetchContent_GetProperties(yaml-cpp)
|
||||
|
||||
if(NOT yaml-cpp_POPULATED)
|
||||
message(STATUS "Fetching yaml-cpp...")
|
||||
FetchContent_Populate(yaml-cpp)
|
||||
add_subdirectory(${yaml-cpp_SOURCE_DIR} ${yaml-cpp_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
target_link_libraries(YOUR_LIBRARY PUBLIC yaml-cpp::yaml-cpp) # The library or executable that require yaml-cpp library
|
||||
```
|
||||
|
||||
## Recent Releases
|
||||
|
||||
[yaml-cpp 0.6.0](https://github.com/jbeder/yaml-cpp/releases/tag/yaml-cpp-0.6.0) released! This release requires C++11, and no longer depends on Boost.
|
||||
|
Reference in New Issue
Block a user