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")
10 string(TOLOWER "${fileOne}" fileOne)
11 string(TOLOWER "${fileTwo}" fileTwo)
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)
22 message(FATAL_ERROR "File \"I_do_not_exist\" was included, although it shouldn't exist,\nIncluded file is \"${_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")
30 string(TOLOWER "${fileOne}" fileOne)
31 string(TOLOWER "${fileTwo}" fileTwo)
34 if(NOT "${fileOne}" STREQUAL "${fileTwo}")
35 message(FATAL_ERROR "Wrong CMake.cmake was included: \"${fileOne}\" expected \"${fileTwo}\"")
36 endif(NOT "${fileOne}" STREQUAL "${fileTwo}")