mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 22:58:14 -05:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
634800c619 |
@@ -196,6 +196,11 @@ These options can also be set as environmental variables.
|
||||
|
||||
In the case that `find_package` requires additional arguments, the parameter `FIND_PACKAGE_ARGUMENTS` may be specified in the `CPMAddPackage` call. The value of this parameter will be forwarded to `find_package`.
|
||||
|
||||
### CPM_USE_NAMED_CACHE_DIRECTORIES
|
||||
|
||||
If set, CPM use additional directory level in cache to improve readability of packages names in IDEs like CLion. It changes cache structure, so all dependencies are downloaded again. There is no problem to mix both structures in one cache directory but then there may be 2 copies of some dependencies.
|
||||
This can also be set as an environmental variable.
|
||||
|
||||
## Local package override
|
||||
|
||||
Library developers are often in the situation where they work on a locally checked out dependency at the same time as on a consumer project.
|
||||
|
||||
@@ -76,6 +76,10 @@ option(CPM_INCLUDE_ALL_IN_PACKAGE_LOCK
|
||||
"Add all packages added through CPM.cmake to the package lock"
|
||||
$ENV{CPM_INCLUDE_ALL_IN_PACKAGE_LOCK}
|
||||
)
|
||||
option(CPM_USE_NAMED_CACHE_DIRECTORIES
|
||||
"Use additional directory of package name in cache on the most nested level."
|
||||
$ENV{CPM_USE_NAMED_CACHE_DIRECTORIES}
|
||||
)
|
||||
|
||||
set(CPM_VERSION
|
||||
${CURRENT_CPM_VERSION}
|
||||
@@ -595,8 +599,13 @@ function(CPMAddPackage)
|
||||
string(TOLOWER ${CPM_ARGS_NAME} lower_case_name)
|
||||
set(origin_parameters ${CPM_ARGS_UNPARSED_ARGUMENTS})
|
||||
list(SORT origin_parameters)
|
||||
string(SHA1 origin_hash "${origin_parameters}")
|
||||
set(download_directory ${CPM_SOURCE_CACHE}/${lower_case_name}/${origin_hash})
|
||||
if(CPM_USE_NAMED_CACHE_DIRECTORIES)
|
||||
string(SHA1 origin_hash "${origin_parameters};NEW_CACHE_STRUCTURE_TAG")
|
||||
set(download_directory ${CPM_SOURCE_CACHE}/${lower_case_name}/${origin_hash}/${CPM_ARGS_NAME})
|
||||
else()
|
||||
string(SHA1 origin_hash "${origin_parameters}")
|
||||
set(download_directory ${CPM_SOURCE_CACHE}/${lower_case_name}/${origin_hash})
|
||||
endif()
|
||||
# Expand `download_directory` relative path. This is important because EXISTS doesn't work for
|
||||
# relative paths.
|
||||
get_filename_component(download_directory ${download_directory} ABSOLUTE)
|
||||
|
||||
Reference in New Issue
Block a user