From 611a3000f7542499f6f3b654ad303fc6c5f85882 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 31 Jan 2025 12:27:29 -0500 Subject: cmSystemTools: Make MaybePrependCmdExe case-insensitive --- Source/cmSystemTools.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0e6041f..54104db 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -792,8 +792,10 @@ void cmSystemTools::MaybePrependCmdExe(std::vector& cmdLine) #if defined(_WIN32) && !defined(__CYGWIN__) if (!cmdLine.empty()) { auto const& applicationName = cmdLine.at(0); - if (cmSystemTools::StringEndsWith(applicationName, ".bat") || - cmSystemTools::StringEndsWith(applicationName, ".cmd")) { + static cmsys::RegularExpression const winCmdRegex( + "\\.([Bb][Aa][Tt]|[Cc][Mm][Dd])$"); + cmsys::RegularExpressionMatch winCmdMatch; + if (winCmdRegex.find(applicationName.c_str(), winCmdMatch)) { std::vector output; output.reserve(cmdLine.size() + 2); output.emplace_back(cmSystemTools::GetComspec()); -- cgit v0.12