Fix download_command by declaring it a multi-value option (#473)

This commit is contained in:
Lars Melchior
2023-09-18 15:37:35 +02:00
committed by GitHub
parent 52ee7c9d53
commit 16c6a3b0af
2 changed files with 27 additions and 4 deletions

View File

@@ -528,7 +528,6 @@ function(CPMAddPackage)
BITBUCKET_REPOSITORY
GIT_REPOSITORY
SOURCE_DIR
DOWNLOAD_COMMAND
FIND_PACKAGE_ARGUMENTS
NO_CACHE
SYSTEM
@@ -537,7 +536,7 @@ function(CPMAddPackage)
SOURCE_SUBDIR
)
set(multiValueArgs URL OPTIONS)
set(multiValueArgs URL OPTIONS DOWNLOAD_COMMAND)
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
@@ -1098,13 +1097,12 @@ function(cpm_prettify_package_arguments OUT_VAR IS_IN_COMMENT)
GITLAB_REPOSITORY
GIT_REPOSITORY
SOURCE_DIR
DOWNLOAD_COMMAND
FIND_PACKAGE_ARGUMENTS
NO_CACHE
SYSTEM
GIT_SHALLOW
)
set(multiValueArgs OPTIONS)
set(multiValueArgs URL OPTIONS DOWNLOAD_COMMAND)
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
foreach(oneArgName ${oneValueArgs})

View 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