Skip to content

Commit 16c6a3b

Browse files
authored
Fix download_command by declaring it a multi-value option (#473)
1 parent 52ee7c9 commit 16c6a3b

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

cmake/CPM.cmake

+2-4
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@ function(CPMAddPackage)
528528
BITBUCKET_REPOSITORY
529529
GIT_REPOSITORY
530530
SOURCE_DIR
531-
DOWNLOAD_COMMAND
532531
FIND_PACKAGE_ARGUMENTS
533532
NO_CACHE
534533
SYSTEM
@@ -537,7 +536,7 @@ function(CPMAddPackage)
537536
SOURCE_SUBDIR
538537
)
539538

540-
set(multiValueArgs URL OPTIONS)
539+
set(multiValueArgs URL OPTIONS DOWNLOAD_COMMAND)
541540

542541
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}")
543542

@@ -1098,13 +1097,12 @@ function(cpm_prettify_package_arguments OUT_VAR IS_IN_COMMENT)
10981097
GITLAB_REPOSITORY
10991098
GIT_REPOSITORY
11001099
SOURCE_DIR
1101-
DOWNLOAD_COMMAND
11021100
FIND_PACKAGE_ARGUMENTS
11031101
NO_CACHE
11041102
SYSTEM
11051103
GIT_SHALLOW
11061104
)
1107-
set(multiValueArgs OPTIONS)
1105+
set(multiValueArgs URL OPTIONS DOWNLOAD_COMMAND)
11081106
cmake_parse_arguments(CPM_ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
11091107

11101108
foreach(oneArgName ${oneValueArgs})
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require_relative './lib'
2+
3+
# Tests using a multi-argumenet download command to fetch a dependency
4+
5+
class DownloadCommand < IntegrationTest
6+
7+
def test_fetch_dependency_using_download_command
8+
prj = make_project from_template: 'using-adder'
9+
10+
prj.create_lists_from_default_template package: <<~PACK
11+
set(DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/_deps/testpack-adder-src)
12+
CPMAddPackage(
13+
NAME testpack-adder
14+
SOURCE_DIR ${DOWNLOAD_DIR}
15+
DOWNLOAD_COMMAND git clone --depth 1 --branch v1.0.0 https://github.com/cpm-cmake/testpack-adder.git ${DOWNLOAD_DIR}
16+
OPTIONS "ADDER_BUILD_TESTS OFF"
17+
)
18+
PACK
19+
20+
# configure with unpopulated cache
21+
assert_success prj.configure
22+
assert_success prj.build
23+
end
24+
25+
end

0 commit comments

Comments
 (0)