mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 06:37:43 -05:00
Add per package CPM_DOWNLOAD controls (#336)
* Add per project CPM_DOWNLOAD controls Introduces support for `CPM_<PACKAGE>_DOWNLOAD` variable ( and env ) which allows finer grained control. * Address PR feedback on API names
This commit is contained in:
@@ -183,6 +183,7 @@ You can use `CPM_SOURCE_CACHE` on GitHub Actions workflows [cache](https://githu
|
||||
If set, CPM will forward all calls to `CPMFindPackage` as `CPMAddPackage`.
|
||||
This is useful to create reproducible builds or to determine if the source parameters have all been set correctly.
|
||||
This can also be set as an environmental variable.
|
||||
This can be controlled on a per package basis with the `CPM_DOWNLOAD_<dependency name>` variable.
|
||||
|
||||
### CPM_USE_LOCAL_PACKAGES
|
||||
|
||||
|
||||
@@ -251,7 +251,13 @@ function(CPMFindPackage)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CPM_DOWNLOAD_ALL)
|
||||
set(downloadPackage ${CPM_DOWNLOAD_ALL})
|
||||
if(DEFINED CPM_DOWNLOAD_${CPM_ARGS_NAME})
|
||||
set(downloadPackage ${CPM_DOWNLOAD_${CPM_ARGS_NAME}})
|
||||
elseif(DEFINED ENV{CPM_DOWNLOAD_${CPM_ARGS_NAME}})
|
||||
set(downloadPackage $ENV{CPM_DOWNLOAD_${CPM_ARGS_NAME}})
|
||||
endif()
|
||||
if(downloadPackage)
|
||||
CPMAddPackage(${ARGN})
|
||||
cpm_export_variables(${CPM_ARGS_NAME})
|
||||
return()
|
||||
|
||||
Reference in New Issue
Block a user