summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-09-09 00:06:13 (GMT)
committerBrad King <brad.king@kitware.com>2023-09-10 11:33:47 (GMT)
commit84a25fc263b19dc12b062b1272546638721ca28a (patch)
tree2c5a75a6f073119178d9691b80a9c6a6260fb3ab /Tests
parentcdcff0a0f0b67b19ebd0fb49c6d54a9bca71581e (diff)
downloadCMake-84a25fc263b19dc12b062b1272546638721ca28a.zip
CMake-84a25fc263b19dc12b062b1272546638721ca28a.tar.gz
CMake-84a25fc263b19dc12b062b1272546638721ca28a.tar.bz2
cmake_host_system_information: Add MSYSTEM_PREFIX query
Add a query on Windows hosts for the installation prefix of a MSYS or MinGW development environment. Issue: #24216
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty-stdout.txt1
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty.cmake3
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-result.txt1
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-stderr.txt3
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake2
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-stdout.txt2
-rw-r--r--Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX.cmake7
-rw-r--r--Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake11
9 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 5e212bd..02efb25 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -474,6 +474,9 @@ if(NOT CMake_TEST_EXTERNAL_CMAKE)
endif()
add_RunCMake_test(execute_process)
add_RunCMake_test(export)
+if(CMake_TEST_MSYSTEM_PREFIX)
+ list(APPEND cmake_host_system_information_ARGS -DCMake_TEST_MSYSTEM_PREFIX=${CMake_TEST_MSYSTEM_PREFIX})
+endif()
add_RunCMake_test(cmake_host_system_information)
add_RunCMake_test(cmake_language)
add_RunCMake_test(cmake_minimum_required)
diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty-stdout.txt b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty-stdout.txt
new file mode 100644
index 0000000..d5a0ca8
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty-stdout.txt
@@ -0,0 +1 @@
+MSYSTEM_PREFIX=''
diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty.cmake b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty.cmake
new file mode 100644
index 0000000..ac36c8d
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Empty.cmake
@@ -0,0 +1,3 @@
+unset(ENV{MSYSTEM})
+cmake_host_system_information(RESULT result QUERY MSYSTEM_PREFIX)
+message(STATUS "MSYSTEM_PREFIX='${result}'")
diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-result.txt b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-stderr.txt b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-stderr.txt
new file mode 100644
index 0000000..89c4e9b
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error at [^
+]*/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake:[0-9]+ \(cmake_host_system_information\):
+ cmake_host_system_information does not recognize <key> MSYSTEM_PREFIX$
diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake
new file mode 100644
index 0000000..dc1def3
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-Missing.cmake
@@ -0,0 +1,2 @@
+unset(ENV{MSYSTEM})
+cmake_host_system_information(RESULT result QUERY MSYSTEM_PREFIX)
diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-stdout.txt b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-stdout.txt
new file mode 100644
index 0000000..f6e2549
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX-stdout.txt
@@ -0,0 +1,2 @@
+-- MSYSTEM_PREFIX='[^
+]+'
diff --git a/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX.cmake b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX.cmake
new file mode 100644
index 0000000..d1c996b
--- /dev/null
+++ b/Tests/RunCMake/cmake_host_system_information/MSYSTEM_PREFIX.cmake
@@ -0,0 +1,7 @@
+cmake_host_system_information(RESULT result QUERY MSYSTEM_PREFIX)
+message(STATUS "MSYSTEM_PREFIX='${result}'")
+if(CMake_TEST_MSYSTEM_PREFIX)
+ if(NOT "${result}" STREQUAL "${CMake_TEST_MSYSTEM_PREFIX}")
+ message(FATAL_ERROR "Actual result:\n ${result}\nis not expected result:\n ${CMake_TEST_MSYSTEM_PREFIX}")
+ endif()
+endif()
diff --git a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
index 9122470..0b3576d 100644
--- a/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_host_system_information/RunCMakeTest.cmake
@@ -22,6 +22,17 @@ else()
run_cmake(VsMSBuildMissing)
endif()
+if(CMAKE_HOST_WIN32)
+ run_cmake_script(MSYSTEM_PREFIX-Empty)
+ if("$ENV{MSYSTEM}" MATCHES "(MSYS|MINGW32|MINGW64|UCRT64)")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-$ENV{MSYSTEM}")
+ run_cmake_script(MSYSTEM_PREFIX -DCMake_TEST_MSYSTEM_PREFIX=${CMake_TEST_MSYSTEM_PREFIX})
+ unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+ endif()
+else()
+ run_cmake_script(MSYSTEM_PREFIX-Missing)
+endif()
+
# WINDOWS_REGISTRY tests
run_cmake(Registry_NoArgs)
run_cmake(Registry_BadQuery1)