Introduce "generator expressions" to add_test()
[cmake.git] / Tests / CMakeTests / IncludeTest.cmake.in
blob01cec38f4038cd4a453dddb8cbe09e6b249c51db
1 # this one must silently fail
2 include(I_am_not_here OPTIONAL)
4 # this one must be found and the result must be put into _includedFile
5 include(CMake RESULT_VARIABLE _includedFile)
7 set(fileOne "${_includedFile}")
8 set(fileTwo "${CMAKE_ROOT}/Modules/CMake.cmake")
9 if(WIN32)
10   string(TOLOWER "${fileOne}" fileOne)
11   string(TOLOWER "${fileTwo}" fileTwo)
12 endif(WIN32)
14 if(NOT "${fileOne}"   STREQUAL "${fileTwo}")
15    message(FATAL_ERROR "Wrong CMake.cmake was included: \"${fileOne}\" expected \"${fileTwo}\"")
16 endif(NOT "${fileOne}"   STREQUAL "${fileTwo}")
18 # this one must return NOTFOUND in _includedFile
19 include(I_do_not_exist OPTIONAL RESULT_VARIABLE _includedFile)
21 if(_includedFile)
22    message(FATAL_ERROR "File \"I_do_not_exist\" was included, although it shouldn't exist,\nIncluded file is \"${_includedFile}\"")
23 endif(_includedFile)
25 # and this one must succeed too
26 include(CMake OPTIONAL RESULT_VARIABLE _includedFile)
27 set(fileOne "${_includedFile}")
28 set(fileTwo "${CMAKE_ROOT}/Modules/CMake.cmake")
29 if(WIN32)
30   string(TOLOWER "${fileOne}" fileOne)
31   string(TOLOWER "${fileTwo}" fileTwo)
32 endif(WIN32)
34 if(NOT "${fileOne}"   STREQUAL "${fileTwo}")
35    message(FATAL_ERROR "Wrong CMake.cmake was included: \"${fileOne}\" expected \"${fileTwo}\"")
36 endif(NOT "${fileOne}"   STREQUAL "${fileTwo}")