Skip to content

Commit

Permalink
Add CMake integration example
Browse files Browse the repository at this point in the history
  • Loading branch information
Trompettesib authored and jbeder committed Jan 4, 2024
1 parent 94710bb commit c28295b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c28295b

Please sign in to comment.