mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 19:00:54 -06:00
cmSystemTools: use the actual case for root detection
On Windows, calling a binary installed with the default `bin` binary directory will fail to be detected when called as `BIN\cmake.exe` due to the string compare. Get the actual case of the path before checking that the path ends with `CMAKE_BIN_DIR`. Fixes #16574.
This commit is contained in:
@@ -1979,7 +1979,8 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
|
||||
// Install tree has
|
||||
// - "<prefix><CMAKE_BIN_DIR>/cmake"
|
||||
// - "<prefix><CMAKE_DATA_DIR>"
|
||||
if (cmHasSuffix(exe_dir, CMAKE_BIN_DIR)) {
|
||||
const std::string actual_case = cmSystemTools::GetActualCaseForPath(exe_dir);
|
||||
if (cmHasSuffix(actual_case, CMAKE_BIN_DIR)) {
|
||||
std::string const prefix =
|
||||
exe_dir.substr(0, exe_dir.size() - strlen(CMAKE_BIN_DIR));
|
||||
cmSystemToolsCMakeRoot = prefix + CMAKE_DATA_DIR;
|
||||
|
||||
Reference in New Issue
Block a user