mirror of
https://github.com/cpm-cmake/CPM.cmake.git
synced 2025-11-22 04:07:49 -05:00
Compare commits
4 Commits
v0.38.3-rc
...
v0.38.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee6d879a50 | ||
|
|
d6d5d0d5ab | ||
|
|
16c6a3b0af | ||
|
|
52ee7c9d53 |
6
.github/workflows/publish.yaml
vendored
6
.github/workflows/publish.yaml
vendored
@@ -15,9 +15,9 @@ jobs:
|
|||||||
- name: Set CPM version by tag
|
- name: Set CPM version by tag
|
||||||
run: |
|
run: |
|
||||||
mkdir dist
|
mkdir dist
|
||||||
sed -e "s/1.0.0-development-version/${GITHUB_REF/refs\/tags\//v}/g" cmake/CPM.cmake > dist/CPM.cmake
|
sed -e "s/1.0.0-development-version/${GITHUB_REF/refs\/tags\/v}/g" cmake/CPM.cmake > dist/CPM.cmake
|
||||||
sed -e "s/1.0.0-development-version/${GITHUB_REF/refs\/tags\//v}/g" \
|
sed -e "s/1.0.0-development-version/${GITHUB_REF/refs\/tags\/v}/g" \
|
||||||
-e "s/EMPTY_HASH_SUM/$(sha256sum cmake/CPM.cmake | cut -d' ' -f1)/" cmake/get_cpm.cmake > dist/get_cpm.cmake
|
-e "s/CPM_HASH_SUM_PLACEHOLDER/$(sha256sum dist/CPM.cmake | cut -d' ' -f1)/" cmake/get_cpm.cmake > dist/get_cpm.cmake
|
||||||
|
|
||||||
- name: Upload CPM.cmake to release
|
- name: Upload CPM.cmake to release
|
||||||
uses: svenstaro/upload-release-action@v1-release
|
uses: svenstaro/upload-release-action@v1-release
|
||||||
|
|||||||
@@ -528,7 +528,6 @@ function(CPMAddPackage)
|
|||||||
BITBUCKET_REPOSITORY
|
BITBUCKET_REPOSITORY
|
||||||
GIT_REPOSITORY
|
GIT_REPOSITORY
|
||||||
SOURCE_DIR
|
SOURCE_DIR
|
||||||
DOWNLOAD_COMMAND
|
|
||||||
FIND_PACKAGE_ARGUMENTS
|
FIND_PACKAGE_ARGUMENTS
|
||||||
NO_CACHE
|
NO_CACHE
|
||||||
SYSTEM
|
SYSTEM
|
||||||
@@ -537,7 +536,7 @@ function(CPMAddPackage)
|
|||||||
SOURCE_SUBDIR
|
SOURCE_SUBDIR
|
||||||
)
|
)
|
||||||
|
|
||||||
set(multiValueArgs URL OPTIONS)
|
set(multiValueArgs URL OPTIONS DOWNLOAD_COMMAND)
|
||||||
|
|
||||||
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
|
||||||
|
|
||||||
@@ -1096,15 +1095,17 @@ function(cpm_prettify_package_arguments OUT_VAR IS_IN_COMMENT)
|
|||||||
DOWNLOAD_ONLY
|
DOWNLOAD_ONLY
|
||||||
GITHUB_REPOSITORY
|
GITHUB_REPOSITORY
|
||||||
GITLAB_REPOSITORY
|
GITLAB_REPOSITORY
|
||||||
|
BITBUCKET_REPOSITORY
|
||||||
GIT_REPOSITORY
|
GIT_REPOSITORY
|
||||||
SOURCE_DIR
|
SOURCE_DIR
|
||||||
DOWNLOAD_COMMAND
|
|
||||||
FIND_PACKAGE_ARGUMENTS
|
FIND_PACKAGE_ARGUMENTS
|
||||||
NO_CACHE
|
NO_CACHE
|
||||||
SYSTEM
|
SYSTEM
|
||||||
GIT_SHALLOW
|
GIT_SHALLOW
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
SOURCE_SUBDIR
|
||||||
)
|
)
|
||||||
set(multiValueArgs OPTIONS)
|
set(multiValueArgs URL OPTIONS DOWNLOAD_COMMAND)
|
||||||
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
foreach(oneArgName ${oneValueArgs})
|
foreach(oneArgName ${oneValueArgs})
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors
|
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors
|
||||||
|
|
||||||
set(CPM_DOWNLOAD_VERSION 1.0.0-development-version)
|
set(CPM_DOWNLOAD_VERSION 1.0.0-development-version)
|
||||||
set(CPM_HASH_SUM "HASH_SUM_PLACEHOLDER")
|
set(CPM_HASH_SUM "CPM_HASH_SUM_PLACEHOLDER")
|
||||||
|
|
||||||
if(CPM_SOURCE_CACHE)
|
if(CPM_SOURCE_CACHE)
|
||||||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||||
@@ -16,20 +16,9 @@ endif()
|
|||||||
# Expand relative path. This is important if the provided path contains a tilde (~)
|
# Expand relative path. This is important if the provided path contains a tilde (~)
|
||||||
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
|
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
|
||||||
|
|
||||||
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
|
file(DOWNLOAD
|
||||||
file(
|
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
||||||
DOWNLOAD
|
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
|
||||||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
|
||||||
${CPM_DOWNLOAD_LOCATION}
|
|
||||||
STATUS CPM_DOWNLOAD_STATUS
|
|
||||||
EXPECTED_HASH SHA256=${CPM_HASH_SUM}
|
|
||||||
)
|
)
|
||||||
list(GET CPM_DOWNLOAD_STATUS 0 CPM_DOWNLOAD_STATUS_CODE)
|
|
||||||
list(GET CPM_DOWNLOAD_STATUS 1 CPM_DOWNLOAD_ERROR_MESSAGE)
|
|
||||||
if(${CPM_DOWNLOAD_STATUS_CODE} EQUAL 0)
|
|
||||||
message(STATUS "CPM: Download completed successfully.")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "CPM: Error occurred during download: ${CPM_DOWNLOAD_ERROR_MESSAGE}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(${CPM_DOWNLOAD_LOCATION})
|
include(${CPM_DOWNLOAD_LOCATION})
|
||||||
|
|||||||
25
test/integration/test_download_command.rb
Normal file
25
test/integration/test_download_command.rb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
require_relative './lib'
|
||||||
|
|
||||||
|
# Tests using a multi-argumenet download command to fetch a dependency
|
||||||
|
|
||||||
|
class DownloadCommand < IntegrationTest
|
||||||
|
|
||||||
|
def test_fetch_dependency_using_download_command
|
||||||
|
prj = make_project from_template: 'using-adder'
|
||||||
|
|
||||||
|
prj.create_lists_from_default_template package: <<~PACK
|
||||||
|
set(DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/_deps/testpack-adder-src)
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME testpack-adder
|
||||||
|
SOURCE_DIR ${DOWNLOAD_DIR}
|
||||||
|
DOWNLOAD_COMMAND git clone --depth 1 --branch v1.0.0 https://github.com/cpm-cmake/testpack-adder.git ${DOWNLOAD_DIR}
|
||||||
|
OPTIONS "ADDER_BUILD_TESTS OFF"
|
||||||
|
)
|
||||||
|
PACK
|
||||||
|
|
||||||
|
# configure with unpopulated cache
|
||||||
|
assert_success prj.configure
|
||||||
|
assert_success prj.build
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user