From 24502d1321aaf27f0b4006bc89c51e2500d2330f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 4 Nov 2024 10:48:43 +0100 Subject: [PATCH] doc: add documentation for using CPM. --- doc/building-corrade.dox | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/building-corrade.dox b/doc/building-corrade.dox index 4ffa518d5..295d449bf 100644 --- a/doc/building-corrade.dox +++ b/doc/building-corrade.dox @@ -71,6 +71,7 @@ platforms. - @ref building-corrade-packages-gentoo - @ref building-corrade-packages-rpm - @ref building-corrade-packages-brew +- @ref building-corrade-packages-cpm - @ref building-corrade-packages-vcpkg - @ref building-corrade-packages-conan - @ref building-corrade-packages-hunter @@ -235,6 +236,36 @@ If you want to pass additional flags to CMake or @ref building-corrade-features "enable / disable additional features", edit the `*.rb` file. +@subsection building-corrade-packages-cpm CMake Package Manager / CPM + +If you're using [CPM](https://github.com/cpm-cmake/CPM.cmake), adding Corrade +as a dependency can be done with the following. If you're fetching the `master` +branch, it's recommended to disable `GIT_SHALLOW` to perform a full clone +including all tags. If not, the build prints a warning about being unable to +fetch a Git version for the `version.h` header, and will generate a fallback +file instead. + +@code{.cmake} +CPMAddPackage( + NAME corrade + GIT_REPOSITORY https://github.com/mosra/corrade.git + GIT_TAG master + GIT_SHALLOW NO) +@endcode + +If you want to pass additional flags to CMake or +@ref building-corrade-features "enable / disable additional features", pass +then via `OPTIONS`, for example: + +@code{.cmake} +CPMAddPackage( + NAME corrade + ... + OPTIONS + "CORRADE_BUILD_DEPRECATED OFF" + "CORRADE_WITH_INTERCONNECT OFF") +@endcode + @subsection building-corrade-packages-vcpkg Vcpkg package Corrade is available as a [Vcpkg](https://github.com/Microsoft/vcpkg) package.