mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
Make CMAKE_ROOT independent of case of path used to invoke cmake
We compute the location of `CMAKE_ROOT` and other resources relative to the location of our own executable. On some platforms this path is computed in a way that depends on the case of the path used to invoke the executable. Convert the result to the actual case preserved by the filesystem on disk in order to make it consistent regardless of how the executable is launched. This approach generalizes the fix made by commit v3.8.0-rc1~71^2 (cmSystemTools: use the actual case for root detection, 2017-01-18). Issue: #16648
This commit is contained in:
@@ -1978,6 +1978,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
|
||||
// ???
|
||||
}
|
||||
#endif
|
||||
exe_dir = cmSystemTools::GetActualCaseForPath(exe_dir);
|
||||
cmSystemToolsCMakeCommand = exe_dir;
|
||||
cmSystemToolsCMakeCommand += "/cmake";
|
||||
cmSystemToolsCMakeCommand += cmSystemTools::GetExecutableExtension();
|
||||
@@ -2015,8 +2016,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0)
|
||||
// Install tree has
|
||||
// - "<prefix><CMAKE_BIN_DIR>/cmake"
|
||||
// - "<prefix><CMAKE_DATA_DIR>"
|
||||
const std::string actual_case = cmSystemTools::GetActualCaseForPath(exe_dir);
|
||||
if (cmHasSuffix(actual_case, CMAKE_BIN_DIR)) {
|
||||
if (cmHasSuffix(exe_dir, 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