1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 22:37:30 +08:00

cmSystemTools: Restore FindProgram look-up of on-disk case on Windows

KWSys's `FindProgram` no longer looks up the actual case on disk.  This
behavior change was inherited from the change to `CollapseFullPath`.
Extend commit 773b75e4ed (cmake: Explicitly look up on-disk case of
input paths on Windows, 2024-10-23, v4.0.0-rc1~589^2) to cover this by
wrapping `FindProgram` in a CMake-specific layer.

Issue: #20214
This commit is contained in:
Brad King
2025-04-07 19:27:55 -04:00
parent 5d700abda4
commit db0e2574cb
2 changed files with 18 additions and 0 deletions

View File

@@ -2992,6 +2992,16 @@ unsigned int cmSystemTools::RandomNumber()
return static_cast<unsigned int>(gen());
}
std::string cmSystemTools::FindProgram(std::string const& name,
std::vector<std::string> const& path)
{
std::string exe = cmsys::SystemTools::FindProgram(name, path);
if (!exe.empty()) {
exe = cmSystemTools::ToNormalizedPathOnDisk(std::move(exe));
}
return exe;
}
namespace {
std::string InitLogicalWorkingDirectory()
{

View File

@@ -560,6 +560,14 @@ public:
static unsigned int RandomSeed();
static unsigned int RandomNumber();
/**
* Find an executable in the system PATH, with optional extra paths.
* This wraps KWSys's FindProgram to add ToNormalizedPathOnDisk.
*/
static std::string FindProgram(
std::string const& name,
std::vector<std::string> const& path = std::vector<std::string>());
/** Find the directory containing CMake executables. */
static void FindCMakeResources(char const* argv0);