mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 03:59:58 +00:00
ExternalProject: Fix cache generation when args end with "-NOTFOUND"
Generalize the fix in commit v3.11.0-rc4~8^2 (ExternalProject: Fix cache generation when last args ends with "-NOTFOUND", 2018-03-10) to work for any argument rather than just the last one. ExternalProject can now successfully generate the cache file when any (not only the last one) cache variable associated with either `CMAKE_CACHE_ARGS` or `CMAKE_DEFAULT_CACHE_ARGS` configure step option is set to a `<value>` ending with `-NOTFOUND`.
This commit is contained in:
parent
8738eba336
commit
7ad5165c67
@ -1686,7 +1686,7 @@ function(_ep_command_line_to_initial_cache var args force)
|
||||
foreach(line ${args})
|
||||
if("${line}" MATCHES "^-D(.*)")
|
||||
set(line "${CMAKE_MATCH_1}")
|
||||
if(setArg)
|
||||
if(NOT "${setArg}" STREQUAL "")
|
||||
# This is required to build up lists in variables, or complete an entry
|
||||
string(APPEND setArg "${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})")
|
||||
string(APPEND script_initial_cache "\n${setArg}")
|
||||
|
@ -33,3 +33,12 @@ if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE)
|
||||
set(RunCMake_TEST_FAILED "Expected forced TEST_OPTIONAL argument")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT "${_cache}" MATCHES "set\\(TEST_OPTIONAL_LAST \"TEST_OPTIONAL_LAST-NOTFOUND\".+\\)")
|
||||
set(RunCMake_TEST_FAILED "Cannot find TEST_OPTIONAL_LAST argument in cache")
|
||||
return()
|
||||
endif()
|
||||
if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE)
|
||||
set(RunCMake_TEST_FAILED "Expected forced TEST_OPTIONAL_LAST argument")
|
||||
return()
|
||||
endif()
|
||||
|
@ -9,4 +9,5 @@ ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp"
|
||||
CMAKE_CACHE_ARGS
|
||||
"-DFOO:STRING=$<1:BAR>$<0:BAD>"
|
||||
"-DTEST_LIST:STRING=A;B;C"
|
||||
"-DTEST_OPTIONAL:FILEPATH=TEST_OPTIONAL-NOTFOUND")
|
||||
"-DTEST_OPTIONAL:FILEPATH=TEST_OPTIONAL-NOTFOUND"
|
||||
"-DTEST_OPTIONAL_LAST:FILEPATH=TEST_OPTIONAL_LAST-NOTFOUND")
|
||||
|
@ -33,3 +33,12 @@ if("${CMAKE_MATCH_0}" MATCHES FORCE)
|
||||
set(RunCMake_TEST_FAILED "Expected not forced TEST_OPTIONAL argument")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT "${_cache}" MATCHES "set\\(TEST_OPTIONAL_LAST \"TEST_OPTIONAL_LAST-NOTFOUND\".+\\)")
|
||||
set(RunCMake_TEST_FAILED "Cannot find TEST_OPTIONAL_LAST argument in cache")
|
||||
return()
|
||||
endif()
|
||||
if("${CMAKE_MATCH_0}" MATCHES FORCE)
|
||||
set(RunCMake_TEST_FAILED "Expected not forced TEST_OPTIONAL_LAST argument")
|
||||
return()
|
||||
endif()
|
||||
|
@ -9,4 +9,5 @@ ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp"
|
||||
CMAKE_CACHE_DEFAULT_ARGS
|
||||
"-DFOO:STRING=$<1:BAR>$<0:BAD>"
|
||||
"-DTEST_LIST:STRING=A;B;C"
|
||||
"-DTEST_OPTIONAL:FILEPATH=TEST_OPTIONAL-NOTFOUND")
|
||||
"-DTEST_OPTIONAL:FILEPATH=TEST_OPTIONAL-NOTFOUND"
|
||||
"-DTEST_OPTIONAL_LAST:FILEPATH=TEST_OPTIONAL_LAST-NOTFOUND")
|
||||
|
Loading…
Reference in New Issue
Block a user