-
Notifications
You must be signed in to change notification settings - Fork 188
Preparing projects for CPM.cmake
Lars Melchior edited this page Jan 20, 2021
·
5 revisions
CPM.cmake differs from conventional package managers as it supports adding any type of project from any source without any modifications to the original code base. However, this means that all information required to download and configure the project must be provided by project users, as illustrated in the examples. To make this as convenient as possible, please see the following guidelines:
- Use CMake to build your project.
- Structure your project. See Here.
- Use modern CMake features like targets and properties. See here and here.
- Understand semantic versioning here and here.
- Tag your releases with the version prefixed by a
v
. - Use the same version for the installed target for compatibility between local and global installations.
- Don't include tests or other projects from the main CMakeLists.
- Add your libraries dependencies using
CPMAddPackage
(for deterministic builds) orCPMFindPackage
(will use global installs, if available). - Scope any options your root
CMakeLists.txt
depends on (e.g.BUILD_TESTING
->MY_LIBRARY_BUILD_TESTING
)
For a minimal example, see the ModernCppStarter.