summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS-check.cmake
blob: c5018563c1e8d2b9086d2289427220ea67404192 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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()