summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_program/IgnorePrefixPath.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/find_program/IgnorePrefixPath.cmake')
-rw-r--r--Tests/RunCMake/find_program/IgnorePrefixPath.cmake30
1 files changed, 30 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_program/IgnorePrefixPath.cmake b/Tests/RunCMake/find_program/IgnorePrefixPath.cmake
new file mode 100644
index 0000000..5f0dba9
--- /dev/null
+++ b/Tests/RunCMake/find_program/IgnorePrefixPath.cmake
@@ -0,0 +1,30 @@
+function(assert_eq var value)
+ if(NOT "${${var}}" STREQUAL "${value}")
+ message(SEND_ERROR "Expected value of ${var}:\n ${value}\nActual value:\n ${${var}}")
+ endif()
+endfunction()
+
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH FALSE)
+
+set(CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/Prefix)
+set(_old_CMAKE_SYSTEM_PREFIX_PATH ${CMAKE_SYSTEM_PREFIX_PATH})
+set(CMAKE_SYSTEM_PREFIX_PATH ${CMAKE_SOURCE_DIR}/SystemPrefix)
+set(prog_ROOT
+ ${CMAKE_SOURCE_DIR}/Prefix
+ ${CMAKE_SOURCE_DIR}/SystemPrefix
+ )
+
+set(CMAKE_IGNORE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/Prefix)
+set(CMAKE_SYSTEM_IGNORE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/SystemPrefix)
+find_program(prog prog)
+assert_eq(prog "prog-NOTFOUND")
+
+set(CMAKE_PREFIX_PATH)
+set(CMAKE_SYSTEM_PREFIX_PATH ${_old_CMAKE_SYSTEM_PREFIX_PATH})
+set(CMAKE_IGNORE_PREFIX_PATH /)
+set(CMAKE_FIND_ROOT_PATH
+ ${CMAKE_SOURCE_DIR}/Prefix
+ ${CMAKE_SOURCE_DIR}/SystemPrefix
+ )
+find_program(prog2 prog)
+assert_eq(prog2 "prog2-NOTFOUND")