summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake9
-rw-r--r--Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake1
-rw-r--r--Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake1
-rw-r--r--Tests/RunCMake/BuildDepends/WriteDepfile2.cmake8
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_FILE/Example.txt4
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_FILE/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_FILE/VerifyResult.cmake22
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_FILE/test.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt4
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake12
-rw-r--r--Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake3
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-stderr.txt2
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-stderr.txt2
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake13
-rw-r--r--Tests/RunCMake/define_property/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/define_property/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/define_property/define_property.cmake26
-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
23 files changed, 129 insertions, 2 deletions
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
index e4fdb4a..19c09c8 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
@@ -24,6 +24,13 @@ add_library(toplib STATIC toplib.c)
add_subdirectory(DepfileSubdir)
+add_custom_command(
+ OUTPUT toplib2.c
+ DEPFILE toplib2.c.d
+ COMMAND ${CMAKE_COMMAND} -DOUTFILE=toplib2.c -DINFILE=toplibdep2.txt -DDEPFILE=toplib2.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile2.cmake"
+ )
+add_library(toplib2 STATIC toplib2.c)
+
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
function(check_exists file)
if(NOT EXISTS \"\${file}\")
@@ -43,6 +50,7 @@ set(check_pairs
\"${CMAKE_BINARY_DIR}/topcc.c|${CMAKE_BINARY_DIR}/topccdep.txt\"
\"$<TARGET_FILE:topexe>|${CMAKE_BINARY_DIR}/topexedep.txt\"
\"$<TARGET_FILE:toplib>|${CMAKE_BINARY_DIR}/toplibdep.txt\"
+ \"$<TARGET_FILE:toplib2>|${CMAKE_BINARY_DIR}/toplibdep2.txt\"
\"${CMAKE_BINARY_DIR}/DepfileSubdir/subcc.c|${CMAKE_BINARY_DIR}/DepfileSubdir/subccdep.txt\"
\"$<TARGET_FILE:subexe>|${CMAKE_BINARY_DIR}/DepfileSubdir/subexedep.txt\"
\"$<TARGET_FILE:sublib>|${CMAKE_BINARY_DIR}/DepfileSubdir/sublibdep.txt\"
@@ -53,6 +61,7 @@ if(check_step EQUAL 3)
\"${CMAKE_BINARY_DIR}/step3.timestamp|${CMAKE_BINARY_DIR}/topcc.c\"
\"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:topexe>\"
\"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:toplib>\"
+ \"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:toplib2>\"
\"${CMAKE_BINARY_DIR}/step3.timestamp|${CMAKE_BINARY_DIR}/DepfileSubdir/subcc.c\"
\"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:subexe>\"
\"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:sublib>\"
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake
index 0dfe78e..a33a03c 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake
@@ -5,6 +5,7 @@ file(REMOVE "${RunCMake_TEST_BINARY_DIR}/step3.timestamp")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topccdep.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topexedep.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/toplibdep.txt")
+file(TOUCH "${RunCMake_TEST_BINARY_DIR}/toplibdep2.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/subccdep.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/subexedep.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/sublibdep.txt")
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake
index c711514..ee7df7b 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake
@@ -1,6 +1,7 @@
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topccdep.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topexedep.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/toplibdep.txt")
+file(TOUCH "${RunCMake_TEST_BINARY_DIR}/toplibdep2.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/subccdep.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/subexedep.txt")
file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/sublibdep.txt")
diff --git a/Tests/RunCMake/BuildDepends/WriteDepfile2.cmake b/Tests/RunCMake/BuildDepends/WriteDepfile2.cmake
new file mode 100644
index 0000000..f7898f6
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/WriteDepfile2.cmake
@@ -0,0 +1,8 @@
+file(WRITE "${OUTFILE}" [[int main(void)
+{
+ return 0;
+}
+]])
+string(REPLACE [[ ]] [[\ ]] OUTFILE "${OUTFILE}")
+string(REPLACE [[ ]] [[\ ]] INFILE "${INFILE}")
+file(WRITE "${DEPFILE}" "${OUTFILE}:\n${OUTFILE}: ${INFILE}\n")
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index f0457a8..dd786b8 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -418,6 +418,7 @@ add_RunCMake_test(ctest_update)
add_RunCMake_test(ctest_upload)
add_RunCMake_test(ctest_environment)
add_RunCMake_test(ctest_fixtures)
+add_RunCMake_test(define_property)
add_RunCMake_test(file -DCYGWIN=${CYGWIN} -DMSYS=${MSYS})
add_RunCMake_test(file-CHMOD -DMSYS=${MSYS})
add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index eb9ff03..ef4cf5e 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -21,6 +21,8 @@ if(NOT "${DEBUGEDIT}" STREQUAL "DEBUGEDIT-NOTFOUND")
endif()
run_cpack_test(DIST "RPM.DIST" false "MONOLITHIC")
run_cpack_test(DMG_SLA "DragNDrop" false "MONOLITHIC")
+run_cpack_test(DMG_SLA_FILE "DragNDrop" false "MONOLITHIC")
+run_cpack_test(DMG_SLA_OFF "DragNDrop" false "MONOLITHIC")
run_cpack_test(EMPTY_DIR "RPM.EMPTY_DIR;DEB.EMPTY_DIR;TGZ" true "MONOLITHIC;COMPONENT")
run_cpack_test(VERSION "RPM.VERSION;DEB.VERSION" false "MONOLITHIC;COMPONENT")
run_cpack_test(EXTRA "DEB.EXTRA" false "COMPONENT")
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/Example.txt b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/Example.txt
new file mode 100644
index 0000000..94b19c3
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/Example.txt
@@ -0,0 +1,4 @@
+Example License File
+--------------------
+
+This is an example license file for a DMG.
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/ExpectedFiles.cmake
new file mode 100644
index 0000000..d1a3a5f
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/VerifyResult.cmake
new file mode 100644
index 0000000..55fb3fb
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/VerifyResult.cmake
@@ -0,0 +1,22 @@
+set(dmg "${bin_dir}/${FOUND_FILE_1}")
+execute_process(COMMAND hdiutil udifderez -xml "${dmg}" OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res)
+if(NOT res EQUAL 0)
+ string(REPLACE "\n" "\n " err " ${err}")
+ message(FATAL_ERROR "Running 'hdiutil udifderez -xml' on\n ${dmg}\nfailed with:\n${err}")
+endif()
+foreach(key "LPic" "STR#" "TEXT")
+ if(NOT out MATCHES "<key>${key}</key>")
+ string(REPLACE "\n" "\n " out " ${out}")
+ message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${dmg}\ndid not show '${key}' key:\n${out}")
+ endif()
+endforeach()
+foreach(line
+ # TEXT first and last base64 lines
+ "\tRXhhbXBsZSBMaWNlbnNlIEZpbGUNLS0tLS0tLS0tLS0tLS0tLS0t\n"
+ "\tYSBETUcuDQ0=\n"
+ )
+ if(NOT out MATCHES "${line}")
+ string(REPLACE "\n" "\n " out " ${out}")
+ message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${dmg}\ndid not show '${line}':\n${out}")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/test.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/test.cmake
new file mode 100644
index 0000000..eac820e
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_FILE/test.cmake
@@ -0,0 +1,2 @@
+install(FILES CMakeLists.txt DESTINATION foo)
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/Example.txt")
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt
new file mode 100644
index 0000000..94b19c3
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt
@@ -0,0 +1,4 @@
+Example License File
+--------------------
+
+This is an example license file for a DMG.
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake
new file mode 100644
index 0000000..d1a3a5f
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake
@@ -0,0 +1,2 @@
+set(EXPECTED_FILES_COUNT "1")
+set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt")
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake
new file mode 100644
index 0000000..571a4df
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake
@@ -0,0 +1,12 @@
+set(dmg "${bin_dir}/${FOUND_FILE_1}")
+execute_process(COMMAND hdiutil udifderez -xml "${dmg}" OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res)
+if(NOT res EQUAL 0)
+ string(REPLACE "\n" "\n " err " ${err}")
+ message(FATAL_ERROR "Running 'hdiutil udifderez -xml' on\n ${dmg}\nfailed with:\n${err}")
+endif()
+foreach(key "LPic" "STR#" "TEXT")
+ if(out MATCHES "<key>${key}</key>")
+ string(REPLACE "\n" "\n " out " ${out}")
+ message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${dmg}\nhas unexpected '${key}' key:\n${out}")
+ endif()
+endforeach()
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake
new file mode 100644
index 0000000..2b09cab
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake
@@ -0,0 +1,3 @@
+install(FILES CMakeLists.txt DESTINATION foo)
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/Example.txt")
+set(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE OFF)
diff --git a/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-stderr.txt b/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-stderr.txt
index 89d0565..99491e8 100644
--- a/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-stderr.txt
+++ b/Tests/RunCMake/CheckCompilerFlag/NonExistentLanguage-stderr.txt
@@ -1,2 +1,2 @@
-CMake Error at .*CheckCompilerFlag\.cmake:[0-9]+ \(message\):
+CMake Error at .*CheckFlagCommonConfig\.cmake:[0-9]+ \(message\):
check_compiler_flag: FAKE_LANG: unknown language.
diff --git a/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-stderr.txt b/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-stderr.txt
index 23dd4a1..82c47e3 100644
--- a/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-stderr.txt
+++ b/Tests/RunCMake/CheckCompilerFlag/NotEnabledLanguage-stderr.txt
@@ -1,2 +1,2 @@
-CMake Error at .*CheckCompilerFlag\.cmake:[0-9]+ \(message\):
+CMake Error at .*CheckFlagCommonConfig\.cmake:[0-9]+ \(message\):
check_compiler_flag: C: needs to be enabled before use.
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 74cd90a..3622e64 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -130,6 +130,19 @@ project(ExplicitDirsMissing LANGUAGES NONE)
set(RunCMake_TEST_BINARY_DIR "${source_dir}")
run_cmake_with_options(no-S-B -DFOO=BAR)
+ file(WRITE ${source_dir}/CMakeLists.txt [=[
+cmake_minimum_required(VERSION 3.13)
+project(ExplicitDirsMissing LANGUAGES NONE)
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
+ message(FATAL_ERROR "CWD used as binary dir")
+endif()
+]=])
+
+ file(REMOVE_RECURSE "${source_dir}/build")
+ # Test with a setup where binary_dir won't be created by `run_cmake_with_options`
+ run_cmake_with_options(S-arg-build-dir-not-created -S ${source_dir} build/)
+ run_cmake_with_options(S-arg-reverse-build-dir-not-created build/ -S${source_dir} )
+
set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs)
set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build)
diff --git a/Tests/RunCMake/define_property/CMakeLists.txt b/Tests/RunCMake/define_property/CMakeLists.txt
new file mode 100644
index 0000000..d8200fc
--- /dev/null
+++ b/Tests/RunCMake/define_property/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.22)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/define_property/RunCMakeTest.cmake b/Tests/RunCMake/define_property/RunCMakeTest.cmake
new file mode 100644
index 0000000..5cb581b
--- /dev/null
+++ b/Tests/RunCMake/define_property/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(define_property)
diff --git a/Tests/RunCMake/define_property/define_property.cmake b/Tests/RunCMake/define_property/define_property.cmake
new file mode 100644
index 0000000..d657538
--- /dev/null
+++ b/Tests/RunCMake/define_property/define_property.cmake
@@ -0,0 +1,26 @@
+function(assert_prop_scope_eq prop scope value)
+ get_property(actual_value TARGET NONE PROPERTY ${prop} ${scope})
+ if(NOT actual_value STREQUAL value)
+ message(SEND_ERROR "Expected value of ${prop}'s ${scope}:\n ${value}\nActual value:\n ${actual_value}")
+ endif()
+endfunction()
+
+define_property(TARGET PROPERTY PROP1)
+define_property(TARGET PROPERTY PROP2
+ BRIEF_DOCS "Brief")
+define_property(TARGET PROPERTY PROP3
+ FULL_DOCS "Full")
+define_property(TARGET PROPERTY PROP4
+ BRIEF_DOCS "Brief"
+ FULL_DOCS "Full")
+
+assert_prop_scope_eq(PROP0 BRIEF_DOCS "NOTFOUND")
+assert_prop_scope_eq(PROP0 FULL_DOCS "NOTFOUND")
+assert_prop_scope_eq(PROP1 BRIEF_DOCS "NOTFOUND")
+assert_prop_scope_eq(PROP1 FULL_DOCS "NOTFOUND")
+assert_prop_scope_eq(PROP2 BRIEF_DOCS "Brief")
+assert_prop_scope_eq(PROP2 FULL_DOCS "NOTFOUND")
+assert_prop_scope_eq(PROP3 BRIEF_DOCS "NOTFOUND")
+assert_prop_scope_eq(PROP3 FULL_DOCS "Full")
+assert_prop_scope_eq(PROP4 BRIEF_DOCS "Brief")
+assert_prop_scope_eq(PROP4 FULL_DOCS "Full")
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}")