blob: e0d826d797e39e20e4467d517c7a00d95c708954 (
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
|
message(STATUS "testname='${testname}'")
function(do_end content)
file(WRITE "${dir}/${testname}.cmake" "${content}")
execute_process(COMMAND ${CMAKE_COMMAND} -P "${dir}/${testname}.cmake"
RESULT_VARIABLE rv)
if(NOT rv EQUAL 0)
message(FATAL_ERROR "${testname} failed")
endif()
endfunction()
if(testname STREQUAL bad_else) # fail
do_end("else()\n")
elseif(testname STREQUAL bad_elseif) # fail
do_end("elseif()\n")
elseif(testname STREQUAL bad_endforeach) # fail
do_end("endforeach()\n")
elseif(testname STREQUAL bad_endfunction) # fail
do_end("endfunction()\n")
elseif(testname STREQUAL bad_endif) # fail
do_end("cmake_minimum_required(VERSION 2.8.12)\nendif()\n")
elseif(testname STREQUAL endif_low_min_version) # fail
do_end("cmake_minimum_required(VERSION 1.2)\nendif()\n")
elseif(testname STREQUAL endif_no_min_version) # fail
do_end("endif()\n")
elseif(testname STREQUAL bad_endmacro) # fail
do_end("endmacro()\n")
elseif(testname STREQUAL bad_endwhile) # fail
do_end("endwhile()\n")
else() # fail
message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'")
endif()
|