summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorWilliam R. Dieter <william.r.dieter@intel.com>2022-01-13 17:18:12 (GMT)
committerBrad King <brad.king@kitware.com>2022-01-14 18:15:09 (GMT)
commitb916860a488bedca1baa3e88538a047333d846f5 (patch)
treee36d94f60a5981802f596bc27ba1736d844693f8 /Tests
parent4da4e31db2aa3898346caaadec222881e803865b (diff)
downloadCMake-b916860a488bedca1baa3e88538a047333d846f5.zip
CMake-b916860a488bedca1baa3e88538a047333d846f5.tar.gz
CMake-b916860a488bedca1baa3e88538a047333d846f5.tar.bz2
Tests: Avoid interference from environment in RunCMake.find_library
Clear $ENV{CMAKE_PREFIX_PATH} in several RunCMake.find_library tests because on Windows, a CMAKE_PREFIX_PATH with two consecutive semicolons causes a library to be found when it should not be. None of the updated tests expect CMAKE_PREFIX_PATH from the environment to influence the test, so clear the variable entirely to guarantee it will not affect the test. Fixes: #23111 Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/find_library/FromPATHEnv.cmake3
-rw-r--r--Tests/RunCMake/find_library/FromPATHEnvDebugVar.cmake3
-rw-r--r--Tests/RunCMake/find_library/FromPrefixPath.cmake3
3 files changed, 9 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_library/FromPATHEnv.cmake b/Tests/RunCMake/find_library/FromPATHEnv.cmake
index c24e640..ba4dd37 100644
--- a/Tests/RunCMake/find_library/FromPATHEnv.cmake
+++ b/Tests/RunCMake/find_library/FromPATHEnv.cmake
@@ -1,6 +1,8 @@
list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib)
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a)
set(ENV_PATH "$ENV{PATH}")
+set(ENV_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
+set(ENV{CMAKE_PREFIX_PATH} "")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libcreated.a" "created")
@@ -33,3 +35,4 @@ foreach(path "/does_not_exist" "/lib" "")
endforeach()
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON)
set(ENV{PATH} "${ENV_PATH}")
+set(ENV{CMAKE_PREFIX_PATH} "${ENV_CMAKE_PREFIX_PATH}")
diff --git a/Tests/RunCMake/find_library/FromPATHEnvDebugVar.cmake b/Tests/RunCMake/find_library/FromPATHEnvDebugVar.cmake
index c24e640..ba4dd37 100644
--- a/Tests/RunCMake/find_library/FromPATHEnvDebugVar.cmake
+++ b/Tests/RunCMake/find_library/FromPATHEnvDebugVar.cmake
@@ -1,6 +1,8 @@
list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib)
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a)
set(ENV_PATH "$ENV{PATH}")
+set(ENV_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
+set(ENV{CMAKE_PREFIX_PATH} "")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libcreated.a" "created")
@@ -33,3 +35,4 @@ foreach(path "/does_not_exist" "/lib" "")
endforeach()
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON)
set(ENV{PATH} "${ENV_PATH}")
+set(ENV{CMAKE_PREFIX_PATH} "${ENV_CMAKE_PREFIX_PATH}")
diff --git a/Tests/RunCMake/find_library/FromPrefixPath.cmake b/Tests/RunCMake/find_library/FromPrefixPath.cmake
index 04763a9..52814e8 100644
--- a/Tests/RunCMake/find_library/FromPrefixPath.cmake
+++ b/Tests/RunCMake/find_library/FromPrefixPath.cmake
@@ -1,7 +1,9 @@
list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib)
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a)
set(ENV_PATH "$ENV{PATH}")
+set(ENV_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
set(ENV{PATH} "")
+set(ENV{CMAKE_PREFIX_PATH} "")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libcreated.a" "created")
@@ -22,3 +24,4 @@ foreach(path "/does_not_exist" "/lib" "")
endforeach()
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON)
set(ENV{PATH} "${ENV_PATH}")
+set(ENV{CMAKE_PREFIX_PATH} "${ENV_CMAKE_PREFIX_PATH}")