ExternalProject: Fix regression in passing list to CMAKE_CACHE_ARGS

Fix passing a list to the CMAKE_CACHE_ARGS and CMAKE_CACHE_DEFAULT_ARGS
options of ExternalProject_Add.

Following commit v3.7.0-rc1~273^2~1 (prefer list(APPEND) over
string(APPEND) where appropriate, 2016-08-08), the semicolon list
separator after the first list element was missing in the generated
cache.
This commit is contained in:
Max Smolens 2016-10-10 11:39:57 -04:00 committed by Brad King
parent b99bbfe88d
commit a3c98cb30e
5 changed files with 25 additions and 3 deletions

View File

@ -1160,7 +1160,7 @@ function(_ep_command_line_to_initial_cache var args force)
endif()
else()
# Assume this is a list to append to the last var
list(APPEND accumulator "${line}")
string(APPEND accumulator ";${line}")
endif()
endforeach()
# Catch the final line of the args

View File

@ -15,3 +15,12 @@ if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE)
set(RunCMake_TEST_FAILED "Expected forced FOO argument")
return()
endif()
if(NOT "${_cache}" MATCHES "set\\(TEST_LIST \"A;B;C\".+\\)")
set(RunCMake_TEST_FAILED "Cannot find TEST_LIST argument in cache")
return()
endif()
if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE)
set(RunCMake_TEST_FAILED "Expected forced TEST_LIST argument")
return()
endif()

View File

@ -5,4 +5,6 @@ include(ExternalProject)
ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp"
DOWNLOAD_COMMAND ""
CMAKE_CACHE_ARGS "-DFOO:STRING=$<1:BAR>$<0:BAD>")
CMAKE_CACHE_ARGS
"-DFOO:STRING=$<1:BAR>$<0:BAD>"
"-DTEST_LIST:STRING=A;B;C")

View File

@ -15,3 +15,12 @@ if("${CMAKE_MATCH_0}" MATCHES FORCE)
set(RunCMake_TEST_FAILED "Expected not forced FOO argument")
return()
endif()
if(NOT "${_cache}" MATCHES "set\\(TEST_LIST \"A;B;C\".+\\)")
set(RunCMake_TEST_FAILED "Cannot find TEST_LIST argument in cache")
return()
endif()
if("${CMAKE_MATCH_0}" MATCHES FORCE)
set(RunCMake_TEST_FAILED "Expected not forced TEST_LIST argument")
return()
endif()

View File

@ -5,4 +5,6 @@ include(ExternalProject)
ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp"
DOWNLOAD_COMMAND ""
CMAKE_CACHE_DEFAULT_ARGS "-DFOO:STRING=$<1:BAR>$<0:BAD>")
CMAKE_CACHE_DEFAULT_ARGS
"-DFOO:STRING=$<1:BAR>$<0:BAD>"
"-DTEST_LIST:STRING=A;B;C")