summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab/ci/configure_mingw_osdn_io_common.cmake3
-rw-r--r--Help/command/cmake_host_system_information.rst7
-rw-r--r--Help/command/if.rst20
-rw-r--r--Help/release/dev/host-msystem-prefix.rst6
-rw-r--r--Modules/FindBoost.cmake20
-rw-r--r--Modules/FindLua50.cmake15
-rw-r--r--Modules/FindLua51.cmake13
-rw-r--r--Modules/FindPkgConfig.cmake4
-rw-r--r--Modules/FortranCInterface.cmake1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCMakeHostSystemInformationCommand.cxx116
-rw-r--r--Source/cmDebuggerWindowsPipeConnection.cxx17
-rw-r--r--Source/cmDebuggerWindowsPipeConnection.h2
-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
22 files changed, 209 insertions, 50 deletions
diff --git a/.gitlab/ci/configure_mingw_osdn_io_common.cmake b/.gitlab/ci/configure_mingw_osdn_io_common.cmake
index 55dce1d..d316233 100644
--- a/.gitlab/ci/configure_mingw_osdn_io_common.cmake
+++ b/.gitlab/ci/configure_mingw_osdn_io_common.cmake
@@ -1,5 +1,8 @@
set(CMake_TEST_Java OFF CACHE BOOL "")
+get_filename_component(mingw_dir "${CMAKE_CURRENT_LIST_DIR}/../mingw" ABSOLUTE)
+set(CMake_TEST_MSYSTEM_PREFIX "${mingw_dir}" CACHE STRING "")
+
set(configure_no_sccache 1)
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/Help/command/cmake_host_system_information.rst b/Help/command/cmake_host_system_information.rst
index 76824ef..dad0833 100644
--- a/Help/command/cmake_host_system_information.rst
+++ b/Help/command/cmake_host_system_information.rst
@@ -146,6 +146,13 @@ queried. The list of queried values is stored in ``<variable>``.
See :variable:`CMAKE_HOST_SYSTEM_PROCESSOR`
+``MSYSTEM_PREFIX``
+ .. versionadded:: 3.28
+
+ Available only on Windows hosts. In a MSYS or MinGW development
+ environment that sets the ``MSYSTEM`` environment variable, this
+ is its installation prefix. Otherwise, this is the empty string.
+
``DISTRIB_INFO``
.. versionadded:: 3.22
diff --git a/Help/command/if.rst b/Help/command/if.rst
index c47c71b..5d85a1f 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -228,36 +228,36 @@ Comparisons
.. signature:: if(<variable|string> LESS <variable|string>)
:target: LESS
- True if the given string or variable's value is a valid number and less
- than that on the right.
+ True if the given string or variable's value parses as a real number
+ (like a C ``double``) and less than that on the right.
.. signature:: if(<variable|string> GREATER <variable|string>)
:target: GREATER
- True if the given string or variable's value is a valid number and greater
- than that on the right.
+ True if the given string or variable's value parses as a real number
+ (like a C ``double``) and greater than that on the right.
.. signature:: if(<variable|string> EQUAL <variable|string>)
:target: EQUAL
- True if the given string or variable's value is a valid number and equal
- to that on the right.
+ True if the given string or variable's value parses as a real number
+ (like a C ``double``) and equal to that on the right.
.. signature:: if(<variable|string> LESS_EQUAL <variable|string>)
:target: LESS_EQUAL
.. versionadded:: 3.7
- True if the given string or variable's value is a valid number and less
- than or equal to that on the right.
+ True if the given string or variable's value parses as a real number
+ (like a C ``double``) and less than or equal to that on the right.
.. signature:: if(<variable|string> GREATER_EQUAL <variable|string>)
:target: GREATER_EQUAL
.. versionadded:: 3.7
- True if the given string or variable's value is a valid number and greater
- than or equal to that on the right.
+ True if the given string or variable's value parses as a real number
+ (like a C ``double``) and greater than or equal to that on the right.
.. signature:: if(<variable|string> STRLESS <variable|string>)
:target: STRLESS
diff --git a/Help/release/dev/host-msystem-prefix.rst b/Help/release/dev/host-msystem-prefix.rst
new file mode 100644
index 0000000..4377144
--- /dev/null
+++ b/Help/release/dev/host-msystem-prefix.rst
@@ -0,0 +1,6 @@
+host-msystem-prefix
+-------------------
+
+* The :command:`cmake_host_system_information` command gained a
+ ``MSYSTEM_PREFIX`` query for the installation prefix of a MSYS
+ or MinGW development environment on Windows hosts.
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index f2e4804..1f82bb5 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -1365,7 +1365,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- else()
+ elseif(Boost_VERSION_STRING VERSION_LESS 1.83.0)
set(_Boost_CONTRACT_DEPENDENCIES thread chrono)
set(_Boost_COROUTINE_DEPENDENCIES context)
set(_Boost_FIBER_DEPENDENCIES context)
@@ -1380,7 +1380,21 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
set(_Boost_TIMER_DEPENDENCIES chrono)
set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
- if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.83.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
+ else()
+ set(_Boost_CONTRACT_DEPENDENCIES thread chrono)
+ set(_Boost_COROUTINE_DEPENDENCIES context)
+ set(_Boost_FIBER_DEPENDENCIES context)
+ set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+ set(_Boost_JSON_DEPENDENCIES container)
+ set(_Boost_LOG_DEPENDENCIES log_setup filesystem thread regex chrono atomic)
+ set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l)
+ set(_Boost_MPI_DEPENDENCIES serialization)
+ set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization)
+ set(_Boost_NUMPY_DEPENDENCIES python${component_python_version})
+ set(_Boost_THREAD_DEPENDENCIES chrono atomic)
+ set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono atomic)
+ set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+ if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.84.0 AND NOT Boost_NO_WARN_NEW_VERSIONS)
message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
endif()
endif()
@@ -1655,7 +1669,7 @@ else()
# _Boost_COMPONENT_HEADERS. See the instructions at the top of
# _Boost_COMPONENT_DEPENDENCIES.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.82.0" "1.82" "1.81.0" "1.81" "1.80.0" "1.80" "1.79.0" "1.79"
+ "1.83.0" "1.83" "1.82.0" "1.82" "1.81.0" "1.81" "1.80.0" "1.80" "1.79.0" "1.79"
"1.78.0" "1.78" "1.77.0" "1.77" "1.76.0" "1.76" "1.75.0" "1.75" "1.74.0" "1.74"
"1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69"
"1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65"
diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake
index 0575caa..6ba9008 100644
--- a/Modules/FindLua50.cmake
+++ b/Modules/FindLua50.cmake
@@ -5,28 +5,19 @@
FindLua50
---------
-
-
Locate Lua library.
-This module defines::
-::
+This module defines::
LUA50_FOUND, if false, do not try to link to Lua
LUA_LIBRARIES, both lua and lualib
LUA_INCLUDE_DIR, where to find lua.h and lualib.h (and probably lauxlib.h)
-
-
-Note that the expected include convention is
-
-::
+Note that the expected include convention is::
#include "lua.h"
-and not
-
-::
+and not::
#include <lua/lua.h>
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index 283a3eb..405a7a7 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -5,29 +5,20 @@
FindLua51
---------
-
-
Locate Lua library.
This module defines::
-::
-
LUA51_FOUND, if false, do not try to link to Lua
LUA_LIBRARIES
LUA_INCLUDE_DIR, where to find lua.h
LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
-
-Note that the expected include convention is
-
-::
+Note that the expected include convention is::
#include "lua.h"
-and not
-
-::
+and not::
#include <lua/lua.h>
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 4d29f45..6e8b784 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -563,8 +563,8 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
set(_pkg_check_modules_exist_query)
- # check whether version is given
- if (_pkg_check_modules_pkg MATCHES "(.*[^><])(=|[><]=?)(.*)")
+ # check whether version is given while ignoring whitespace
+ if (_pkg_check_modules_pkg MATCHES "(.*[^>< \t])[ \t]*(=|[><]=?)[ \t]*(.*)")
set(_pkg_check_modules_pkg_name "${CMAKE_MATCH_1}")
set(_pkg_check_modules_pkg_op "${CMAKE_MATCH_2}")
set(_pkg_check_modules_pkg_ver "${CMAKE_MATCH_3}")
diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake
index 2c85029..81481a7 100644
--- a/Modules/FortranCInterface.cmake
+++ b/Modules/FortranCInterface.cmake
@@ -374,6 +374,7 @@ function(FortranCInterface_VERIFY)
"-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}"
"-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
"-DFortranCInterface_BINARY_DIR=${FortranCInterface_BINARY_DIR}"
+ "-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
${_FortranCInterface_OSX_ARCH}
${_FortranCInterface_EXE_LINKER_FLAGS}
OUTPUT_VARIABLE _output)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 52a5cb9..df094db 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 27)
-set(CMake_VERSION_PATCH 20230909)
+set(CMake_VERSION_PATCH 20230912)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx
index da680ca..0efb9a4 100644
--- a/Source/cmCMakeHostSystemInformationCommand.cxx
+++ b/Source/cmCMakeHostSystemInformationCommand.cxx
@@ -35,7 +35,6 @@
# include "cmGlobalVisualStudio10Generator.h"
# include "cmGlobalVisualStudioVersionedGenerator.h"
# include "cmVSSetupHelper.h"
-# define HAVE_VS_SETUP_HELPER
#endif
namespace {
@@ -378,9 +377,9 @@ std::map<std::string, std::string> GetOSReleaseVariables(
return data;
}
-cm::optional<std::string> GetValue(cmExecutionStatus& status,
- std::string const& key,
- std::string const& variable)
+cm::optional<std::string> GetDistribValue(cmExecutionStatus& status,
+ std::string const& key,
+ std::string const& variable)
{
const auto prefix = "DISTRIB_"_s;
if (!cmHasPrefix(key, prefix)) {
@@ -414,9 +413,89 @@ cm::optional<std::string> GetValue(cmExecutionStatus& status,
return std::string{};
}
-#ifdef HAVE_VS_SETUP_HELPER
-cm::optional<std::string> GetValue(cmExecutionStatus& status,
- std::string const& key)
+#ifdef _WIN32
+std::string FindMSYSTEM_PREFIX(std::vector<std::string> prefixes)
+{
+ for (std::string const& prefix : prefixes) {
+ std::string out;
+ std::string err;
+ int ret;
+ // In a modern MSYSTEM environment we expect cygpath to be in PATH.
+ std::vector<std::string> cygpath_cmd{ "cygpath", "-w", prefix };
+ if (cmSystemTools::RunSingleCommand(cygpath_cmd, &out, &err, &ret, nullptr,
+ cmSystemTools::OUTPUT_NONE)) {
+ if (ret == 0) {
+ out = cmTrimWhitespace(out);
+ cmSystemTools::ConvertToUnixSlashes(out);
+ if (cmSystemTools::FileIsDirectory(out)) {
+ return out;
+ }
+ }
+ } else {
+ // In a legacy MSYSTEM environment (MinGW/MSYS 1.0) there is no
+ // cygpath but we expect 'sh' to be in PATH.
+ std::vector<std::string> sh_cmd{
+ "sh", "-c", cmStrCat("cd \"", prefix, "\" && cmd //c cd")
+ };
+ if (cmSystemTools::RunSingleCommand(sh_cmd, &out, &err, &ret, nullptr,
+ cmSystemTools::OUTPUT_NONE)) {
+ if (ret == 0) {
+ out = cmTrimWhitespace(out);
+ cmSystemTools::ConvertToUnixSlashes(out);
+ if (cmSystemTools::FileIsDirectory(out)) {
+ return out;
+ }
+ }
+ }
+ }
+ }
+ return {};
+}
+
+std::string FallbackMSYSTEM_PREFIX(cm::string_view msystem)
+{
+ // These layouts are used by distributions such as
+ // * MSYS2: https://www.msys2.org/docs/environments/
+ // * MinGW/MSYS 1.0: http://mingw.osdn.io/
+ if (msystem == "MSYS"_s) {
+ static std::string const msystem_msys = FindMSYSTEM_PREFIX({ "/usr" });
+ return msystem_msys;
+ }
+ if (msystem == "MINGW32"_s) {
+ static std::string const msystem_mingw32 =
+ FindMSYSTEM_PREFIX({ "/mingw32", "/mingw" });
+ return msystem_mingw32;
+ }
+ if (msystem == "MINGW64"_s) {
+ static std::string const msystem_mingw64 =
+ FindMSYSTEM_PREFIX({ "/mingw64" });
+ return msystem_mingw64;
+ }
+ if (msystem == "UCRT64"_s) {
+ static std::string const msystem_ucrt64 =
+ FindMSYSTEM_PREFIX({ "/ucrt64" });
+ return msystem_ucrt64;
+ }
+ if (msystem == "CLANG32"_s) {
+ static std::string const msystem_clang32 =
+ FindMSYSTEM_PREFIX({ "/clang32" });
+ return msystem_clang32;
+ }
+ if (msystem == "CLANG64"_s) {
+ static std::string const msystem_clang64 =
+ FindMSYSTEM_PREFIX({ "/clang64" });
+ return msystem_clang64;
+ }
+ if (msystem == "CLANGARM64"_s) {
+ static std::string const msystem_clangarm64 =
+ FindMSYSTEM_PREFIX({ "/clangarm64" });
+ return msystem_clangarm64;
+ }
+ return {};
+}
+
+cm::optional<std::string> GetWindowsValue(cmExecutionStatus& status,
+ std::string const& key)
{
auto* const gg = status.GetMakefile().GetGlobalGenerator();
for (auto vs : { 15, 16, 17 }) {
@@ -447,6 +526,23 @@ cm::optional<std::string> GetValue(cmExecutionStatus& status,
return vs10gen->FindMSBuildCommandEarly(&status.GetMakefile());
}
+ if (key == "MSYSTEM_PREFIX") {
+ // MSYSTEM_PREFIX is meaningful only under a MSYSTEM environment.
+ cm::optional<std::string> ms = cmSystemTools::GetEnvVar("MSYSTEM");
+ if (!ms || ms->empty()) {
+ return std::string();
+ }
+ // Prefer the MSYSTEM_PREFIX environment variable.
+ if (cm::optional<std::string> msp =
+ cmSystemTools::GetEnvVar("MSYSTEM_PREFIX")) {
+ cmSystemTools::ConvertToUnixSlashes(*msp);
+ if (cmSystemTools::FileIsDirectory(*msp)) {
+ return msp;
+ }
+ }
+ // Fall back to known distribution layouts.
+ return FallbackMSYSTEM_PREFIX(*ms);
+ }
return {};
}
#endif
@@ -598,9 +694,9 @@ bool cmCMakeHostSystemInformationCommand(std::vector<std::string> const& args,
auto value =
GetValueChained(
[&]() { return GetValue(info, key); }
- , [&]() { return GetValue(status, key, variable); }
-#ifdef HAVE_VS_SETUP_HELPER
- , [&]() { return GetValue(status, key); }
+ , [&]() { return GetDistribValue(status, key, variable); }
+#ifdef _WIN32
+ , [&]() { return GetWindowsValue(status, key); }
#endif
);
// clang-format on
diff --git a/Source/cmDebuggerWindowsPipeConnection.cxx b/Source/cmDebuggerWindowsPipeConnection.cxx
index 1c6a2a7..5f6f848 100644
--- a/Source/cmDebuggerWindowsPipeConnection.cxx
+++ b/Source/cmDebuggerWindowsPipeConnection.cxx
@@ -221,13 +221,28 @@ void cmDebuggerPipeClient_WIN32::WaitForConnection()
NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
if (hPipe == INVALID_HANDLE_VALUE) {
auto err = GetLastError();
- throw std::runtime_error("CreateFile failed with " + err);
+ throw std::runtime_error(std::string("CreateFile failed for pipe ") +
+ GetErrorMessage(err));
}
pipes = std::make_unique<DuplexPipe_WIN32>(hPipe);
}
}
+std::string cmDebuggerPipeClient_WIN32::GetErrorMessage(DWORD errorCode)
+{
+ LPSTR message = nullptr;
+ DWORD size = FormatMessageA(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ nullptr, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPSTR)&message, 0, nullptr);
+ std::string errorMessage =
+ this->PipeName + ": " + std::string(message, size);
+ LocalFree(message);
+ return errorMessage;
+}
+
bool cmDebuggerPipeClient_WIN32::isOpen()
{
return pipes != nullptr;
diff --git a/Source/cmDebuggerWindowsPipeConnection.h b/Source/cmDebuggerWindowsPipeConnection.h
index 88ed1de..6a57435 100644
--- a/Source/cmDebuggerWindowsPipeConnection.h
+++ b/Source/cmDebuggerWindowsPipeConnection.h
@@ -90,6 +90,8 @@ public:
bool write(void const* buffer, size_t n) override;
private:
+ std::string GetErrorMessage(DWORD errorCode);
+
std::string const PipeName;
std::unique_ptr<DuplexPipe_WIN32> pipes;
};
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)