toml-f / toml-f

TOML parser implementation for data serialization and deserialization in Fortran
https://toml-f.readthedocs.io
Apache License 2.0
103 stars 24 forks source link

[Doc] linking cmake based project against toml-f using CPM #149

Open MuellerSeb opened 4 months ago

MuellerSeb commented 4 months ago

I'd like to use toml-f as a dependency in my cmake based project and I use CPM to download and compile dependencies.

It would be cool to add a section in the documentation under the "integrate with cmake" part showing how to do this.

Should look like this:

include(cmake/CPM.cmake)
CPMAddPackage("gh:toml-f/toml-f@0.4.2")
target_link_libraries(${LIB_NAME} PUBLIC toml-f::toml-f)

(and 3 lines to link against toml-f is quite amazing IMHO)

If you want to download CPM on the fly, you could also add this:

set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM.cmake")
file(DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.1/CPM.cmake ${CPM_DOWNLOAD_LOCATION})
include(${CPM_DOWNLOAD_LOCATION})

Cheers, Sebastian

awvwgk commented 4 months ago

Contributions are welcome, feel free to sent a patch for adding this to the docs.