mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 22:31:18 -05:00
7ad5165c67
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`.
45 lines
1.4 KiB
CMake
45 lines
1.4 KiB
CMake
set(_cache_file "${RunCMake_TEST_BINARY_DIR}/tmp/FOO-cache-Debug.cmake")
|
|
|
|
if(NOT EXISTS "${_cache_file}")
|
|
set(RunCMake_TEST_FAILED "Initial cache not created")
|
|
return()
|
|
endif()
|
|
|
|
file(READ "${_cache_file}" _cache)
|
|
|
|
if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\)
|
|
set(RunCMake_TEST_FAILED "Cannot find FOO argument in cache")
|
|
return()
|
|
endif()
|
|
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()
|
|
|
|
if(NOT "${_cache}" MATCHES "set\\(TEST_OPTIONAL \"TEST_OPTIONAL-NOTFOUND\".+\\)")
|
|
set(RunCMake_TEST_FAILED "Cannot find TEST_OPTIONAL argument in cache")
|
|
return()
|
|
endif()
|
|
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()
|