CMake/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix-check.cmake
Andrey Pokrovskiy 7bd8cfb813 ExternalProject: Allow generator expressions in initial cache options
Use file(GENERATE) to write the initial cache file so that we can
evaluate generator expressions.  Use a per-config initial cache file
name in case the content varies by configuration.
2015-04-21 10:50:29 -04:00

27 lines
743 B
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\\(BAR \"BAZ\".+\\)") # \(\)
set(RunCMake_TEST_FAILED "Cannot find BAR argument in cache")
return()
endif()
if("${CMAKE_MATCH_0}" MATCHES FORCE)
set(RunCMake_TEST_FAILED "Expected not forced BAR argument")
return()
endif()