diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake index f4d0eea4..9570d497 100644 --- a/cmake/CPM.cmake +++ b/cmake/CPM.cmake @@ -150,6 +150,18 @@ set(CPM_DRY_RUN OFF CACHE INTERNAL "Don't download or configure dependencies (for testing)" ) +set(CPM_GITHUB_REPOSITORY_URL + "github.com" + CACHE INTERNAL "" +) +set(CPM_GITLAB_REPOSITORY_URL + "gitlab.com" + CACHE INTERNAL "" +) +set(CPM_BITBUCKET_REPOSITORY_URL + "bitbucket.org" + CACHE INTERNAL "" +) if(DEFINED ENV{CPM_SOURCE_CACHE}) set(CPM_SOURCE_CACHE_DEFAULT $ENV{CPM_SOURCE_CACHE}) @@ -561,11 +573,11 @@ function(CPMAddPackage) endif() if(DEFINED CPM_ARGS_GITHUB_REPOSITORY) - set(CPM_ARGS_GIT_REPOSITORY "https://github.com/${CPM_ARGS_GITHUB_REPOSITORY}.git") + set(CPM_ARGS_GIT_REPOSITORY "https://${CPM_GITHUB_REPOSITORY_URL}/${CPM_ARGS_GITHUB_REPOSITORY}.git") elseif(DEFINED CPM_ARGS_GITLAB_REPOSITORY) - set(CPM_ARGS_GIT_REPOSITORY "https://gitlab.com/${CPM_ARGS_GITLAB_REPOSITORY}.git") + set(CPM_ARGS_GIT_REPOSITORY "https://${CPM_GITLAB_REPOSITORY_URL}/${CPM_ARGS_GITLAB_REPOSITORY}.git") elseif(DEFINED CPM_ARGS_BITBUCKET_REPOSITORY) - set(CPM_ARGS_GIT_REPOSITORY "https://bitbucket.org/${CPM_ARGS_BITBUCKET_REPOSITORY}.git") + set(CPM_ARGS_GIT_REPOSITORY "https://${CPM_BITBUCKET_REPOSITORY_URL}/${CPM_ARGS_BITBUCKET_REPOSITORY}.git") endif() if(DEFINED CPM_ARGS_GIT_REPOSITORY)