summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2017-01-18 15:06:23 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2017-01-18 15:08:40 (GMT)
commit7f0a21a51eb483c523a2c8880ce4e0466251ec74 (patch)
tree9a5fe90c4c3195f001d40161011ea96a8bd88b4f /Source/cmSystemTools.cxx
parent5cfc2e926af645840c6a0464451af18f08528879 (diff)
downloadCMake-7f0a21a51eb483c523a2c8880ce4e0466251ec74.zip
CMake-7f0a21a51eb483c523a2c8880ce4e0466251ec74.tar.gz
CMake-7f0a21a51eb483c523a2c8880ce4e0466251ec74.tar.bz2
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.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 3d8fdf5..e693beb 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -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;