-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In addition to the predefined prefixes 'gh', 'gl' and 'bb', allow defining your own prefixes for, e.g. internal hosts.
- Loading branch information
1 parent
09b056a
commit 30aae82
Showing
3 changed files
with
43 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,13 @@ CPMAddPackage("uri@version#tag") | |
|
||
In the shorthand syntax if the URI is of the form `gh:user/name`, it is interpreted as GitHub URI and converted to `https://github.com/user/name.git`. If the URI is of the form `gl:user/name`, it is interpreted as a [GitLab](https://gitlab.com/explore/) URI and converted to `https://gitlab.com/user/name.git`. If the URI is of the form `bb:user/name`, it is interpreted as a [Bitbucket](https://bitbucket.org/) URI and converted to `https://bitbucket.org/user/name.git`. Otherwise the URI used verbatim as a git URL. All packages added using the shorthand syntax will be added using the [EXCLUDE_FROM_ALL](https://cmake.org/cmake/help/latest/prop_tgt/EXCLUDE_FROM_ALL.html) flag. | ||
|
||
In addition to the predefined prefixes, it is also possible to define custom prefixes, e.g. | ||
```cmake | ||
set(CPM_CUSTOM_PREFIXES c1:https://c1.example.com c2:https://c2.example.com) | ||
CPMAddPackage("c1:some/[email protected]") | ||
CPMAddPackage("c2:another/repo#v1.2.3") | ||
``` | ||
|
||
The single-argument syntax also works for URLs: | ||
|
||
```cmake | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,13 @@ assert_equal("BITBUCKET_REPOSITORY;foo/bar" "${args}") | |
cpm_parse_add_package_single_arg("bb:foo/Bar" args) | ||
assert_equal("BITBUCKET_REPOSITORY;foo/Bar" "${args}") | ||
|
||
set(CPM_CUSTOM_PREFIXES c1:https://c1.example.com c2:https://c2.example.com/mirror) | ||
cpm_parse_add_package_single_arg("c1:foo/bar@13" args) | ||
assert_equal("GIT_REPOSITORY;foo/bar;VERSION;13;CUSTOM_REPOSITORY;https://c1.example.com" "${args}") | ||
|
||
cpm_parse_add_package_single_arg("c2:foo/Bar#bla" args) | ||
assert_equal("GIT_REPOSITORY;foo/Bar;GIT_TAG;bla;CUSTOM_REPOSITORY;https://c2.example.com/mirror" "${args}") | ||
|
||
cpm_parse_add_package_single_arg("https://github.com/cpm-cmake/[email protected]" args) | ||
assert_equal("GIT_REPOSITORY;https://github.com/cpm-cmake/CPM.cmake.git;VERSION;0.30.5" "${args}") | ||
|
||
|