mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-17 14:47:30 -05:00
* Added assert_not_defined check * Function to get package name form git uri and tests * Autofix format * If name is not provided, try to infer it from the git repo * Unset result of cpm_package_name_from_git_uri if there is no match - Also reordered tests to ensure that the result is actually unset when needed * Removed trailing spaces in README * Updated the main example with the new minimal syntax * Well... autofix format again * Update error message for missing name to reflect the possible auto-infer step * Autofix format... yet again :)
29 lines
875 B
CMake
29 lines
875 B
CMake
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
|
|
|
include(${CPM_PATH}/CPM.cmake)
|
|
include(${CPM_PATH}/testing.cmake)
|
|
|
|
cpm_package_name_from_git_uri("https://github.com/cpm-cmake/CPM.cmake.git" name)
|
|
assert_equal("CPM.cmake" ${name})
|
|
|
|
cpm_package_name_from_git_uri("ssh://user@host.xz:123/path/to/pkg.git/" name)
|
|
assert_equal("pkg" ${name})
|
|
|
|
cpm_package_name_from_git_uri("git://host.xz/path/to/pkg.git" name)
|
|
assert_equal("pkg" ${name})
|
|
|
|
cpm_package_name_from_git_uri("git@host.xz:cool-pkg.git" name)
|
|
assert_equal("cool-pkg" ${name})
|
|
|
|
cpm_package_name_from_git_uri("file:///path/to/pkg33.git" name)
|
|
assert_equal("pkg33" ${name})
|
|
|
|
cpm_package_name_from_git_uri("../local-repo/.git" name)
|
|
assert_equal("local-repo" ${name})
|
|
|
|
cpm_package_name_from_git_uri("asdf" name)
|
|
assert_not_defined(name)
|
|
|
|
cpm_package_name_from_git_uri("/something.git/stuff" name)
|
|
assert_not_defined(name)
|