summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_path/NO_CACHE.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/find_path/NO_CACHE.cmake')
-rw-r--r--Tests/RunCMake/find_path/NO_CACHE.cmake131
1 files changed, 131 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_path/NO_CACHE.cmake b/Tests/RunCMake/find_path/NO_CACHE.cmake
new file mode 100644
index 0000000..4779ac8
--- /dev/null
+++ b/Tests/RunCMake/find_path/NO_CACHE.cmake
@@ -0,0 +1,131 @@
+find_path(PATH_exists
+ NAMES PrefixInPATH.h
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ NO_CACHE
+ NO_DEFAULT_PATH
+ )
+if (DEFINED CACHE{PATH_exists})
+ message(SEND_ERROR "Cache variable defined: PATH_exists")
+endif()
+message(STATUS "PATH_exists='${PATH_exists}'")
+
+
+find_path(PATH_doNotExists
+ NAMES doNotExists.h
+ NO_CACHE
+ )
+if (DEFINED CACHE{PATH_doNotExists})
+ message(SEND_ERROR "Cache variable defined: PATH_doNotExists")
+endif()
+message(STATUS "PATH_exists='${PATH_doNotExists}'")
+
+
+cmake_policy(SET CMP0125 OLD)
+message(STATUS "")
+message(STATUS "Policy CMP0125 = OLD")
+file(REMOVE "${CMAKE_BINARY_DIR}/PrefixInPATH.h")
+
+set(PATH_cache "unknown" CACHE PATH "")
+find_path(PATH_cache
+ NAMES PrefixInPATH.h
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ NO_CACHE
+ NO_DEFAULT_PATH
+ )
+if (NOT DEFINED CACHE{PATH_cache})
+ message(SEND_ERROR "Cache variable defined: PATH_cache")
+endif()
+message(STATUS "CACHED PATH_cache='$CACHE{PATH_cache}'")
+unset(PATH_cache CACHE)
+message(STATUS "PATH_cache='${PATH_cache}'")
+
+
+set(PATH_cache "include" CACHE PATH "")
+unset(PATH_cache)
+find_path(PATH_cache
+ NAMES PrefixInPATH.h
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ NO_CACHE
+ NO_DEFAULT_PATH
+ )
+if (NOT DEFINED CACHE{PATH_cache})
+ message(SEND_ERROR "Cache variable defined: PATH_cache")
+endif()
+message(STATUS "CACHED PATH_cache='$CACHE{PATH_cache}'")
+unset(PATH_cache CACHE)
+message(STATUS "PATH_cache='${PATH_cache}'")
+
+
+set(PATH_cache "include" CACHE PATH "")
+unset(PATH_cache)
+# simulate cache variable defined in command line
+file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/include/PrefixInPATH.h" DESTINATION "${CMAKE_BINARY_DIR}/include")
+set_property(CACHE PATH_cache PROPERTY TYPE UNINITIALIZED)
+find_path(PATH_cache
+ NAMES PrefixInPATH.h
+ NO_CACHE
+ NO_DEFAULT_PATH
+ )
+if (NOT DEFINED CACHE{PATH_cache})
+ message(SEND_ERROR "Cache variable not defined: PATH_cache")
+endif()
+message(STATUS "CACHED PATH_cache='$CACHE{PATH_cache}'")
+unset(PATH_cache CACHE)
+message(STATUS "PATH_cache='${PATH_cache}'")
+
+
+cmake_policy(SET CMP0125 NEW)
+message(STATUS "")
+message(STATUS "Policy CMP0125 = NEW")
+file(REMOVE_RECURSE "${CMAKE_BINARY_DIR}/include")
+
+set(PATH_cache "unknown" CACHE PATH "")
+unset(PATH_cache)
+find_path(PATH_cache
+ NAMES PrefixInPATH.h
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ NO_CACHE
+ NO_DEFAULT_PATH
+ )
+if (NOT DEFINED CACHE{PATH_cache})
+ message(SEND_ERROR "Cache variable defined: PATH_cache")
+endif()
+message(STATUS "CACHED PATH_cache='$CACHE{PATH_cache}'")
+unset(PATH_cache CACHE)
+message(STATUS "PATH_cache='${PATH_cache}'")
+
+
+set(PATH_cache "include" CACHE PATH "")
+unset(PATH_cache)
+find_path(PATH_cache
+ NAMES PrefixInPATH.h
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ NO_CACHE
+ NO_DEFAULT_PATH
+ )
+if (NOT DEFINED CACHE{PATH_cache})
+ message(SEND_ERROR "Cache variable defined: PATH_cache")
+endif()
+message(STATUS "CACHED PATH_cache='$CACHE{PATH_cache}'")
+unset(PATH_cache CACHE)
+message(STATUS "PATH_cache='${PATH_cache}'")
+
+
+set(PATH_cache "include" CACHE PATH "")
+unset(PATH_cache)
+# simulate cache variable defined in command line
+file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/include/PrefixInPATH.h" DESTINATION "${CMAKE_BINARY_DIR}/include")
+set_property(CACHE PATH_cache PROPERTY TYPE UNINITIALIZED)
+find_path(PATH_cache
+ NAMES PrefixInPATH.h
+ NO_CACHE
+ NO_DEFAULT_PATH
+ )
+if (NOT DEFINED CACHE{PATH_cache})
+ message(SEND_ERROR "Cache variable not defined: PATH_cache")
+endif()
+message(STATUS "CACHED PATH_cache='$CACHE{PATH_cache}'")
+unset(PATH_cache CACHE)
+message(STATUS "PATH_cache='${PATH_cache}'")