-
Notifications
You must be signed in to change notification settings - Fork 203
Package lock
The package lock makes it easier to manage and override transitive dependencies. When using a package lock file, dependencies can be updated without modifying the main or other project's CMakeLists.txt
. The package lock file should be added to version control.
After including CPM.cmake, call CPMUsePackageLock(package-lock.cmake)
to include package-lock.cmake
, if it exists. This file can be created and updated using the target cpm-update-package-lock
. Note that it should be added to version control.
The following lines should be added before declaring dependencies in the main CMakeLists.txt
.
include(cmake/CPM.cmake)
CPMUsePackageLock(package-lock.cmake)
To generate and update the package lock file, run the cpm-update-package-lock
target.
cmake -H. -Bbuild
cmake --build build --target cpm-update-package-lock
All CPM dependencies will now be managed inside the package lock file.