mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-16 22:27:41 -05:00
v0.1
CPM
CPM is a very simple package manager written in Cmake based on the amazing DownloadProject script. It is extremely easy to use and drastically simplifies the inclusion of other Cmake-based projects from github.
Usage
To add a new dependency to your project simply add the Projects target name, the git URL and the version. If the git tag for this version does not match the pattern v$VERSION, then the exact branch or tag can be specified with the GIT_TAG argument.
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(MyParser)
# add dependencies
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake)
CPMAddPackage(
NAME LarsParser
VERSION 1.2
GIT_REPOSITORY https://github.com/TheLartians/Parser.git
GIT_TAG master # optional
)
# add executable
set (CMAKE_CXX_STANDARD 17)
add_executable(my-parser my-parser.cpp)
target_link_libraries(cpm-test LarsParser)
Limitations
- First version used: in diamond dependency graphs (e.g.
Adepends onC(v1.1) andAdepends onBdepends onC(v1.2)) the first added dependency will be used (in this caseC@1.1). - No possibility not automatically update dependencies. To update a dependency, version numbers or git tags in the cmake scripts must be adapted manually.
Description
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.
buildscc-plus-pluscmakecppcross-platformdependenciesdependencydependency-managergitpackage-managerreproduciblereproducible-buildssvnupdateversion-managerversions
Readme
MIT
1.8 MiB
Languages
CMake
74.9%
Ruby
24.5%
C++
0.5%