diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-09-30 20:13:10 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-09-30 20:13:10 (GMT) |
commit | 391ff1ec518bea4bbaac95b6a3737b82c65656d3 (patch) | |
tree | 6ed6ea3e762d67fde759abd03dd3afec3c4abf59 /Source/cmSystemTools.cxx | |
parent | d91c3e33cbf9592f90f65bd7d990a8b54ad140d1 (diff) | |
download | CMake-391ff1ec518bea4bbaac95b6a3737b82c65656d3.zip CMake-391ff1ec518bea4bbaac95b6a3737b82c65656d3.tar.gz CMake-391ff1ec518bea4bbaac95b6a3737b82c65656d3.tar.bz2 |
Refactor: Modernize cmSystemTools::FindCMakeResources()
Use cmStrCat(), cmStrLen(), and cmHasLiteralSuffix().
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 1e625a4..7d2dd54 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2166,18 +2166,18 @@ 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)) { + if (cmHasLiteralSuffix(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; + exe_dir.substr(0, exe_dir.size() - cmStrLen(CMAKE_BIN_DIR)); + cmSystemToolsCMakeRoot = cmStrCat(prefix, CMAKE_DATA_DIR); } if (cmSystemToolsCMakeRoot.empty() || !cmSystemTools::FileExists( - (cmSystemToolsCMakeRoot + "/Modules/CMake.cmake"))) { + cmStrCat(cmSystemToolsCMakeRoot, "/Modules/CMake.cmake"))) { // Build tree has "<build>/bin[/<config>]/cmake" and // "<build>/CMakeFiles/CMakeSourceDir.txt". std::string dir = cmSystemTools::GetFilenamePath(exe_dir); - std::string src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt"; + std::string src_dir_txt = cmStrCat(dir, "/CMakeFiles/CMakeSourceDir.txt"); cmsys::ifstream fin(src_dir_txt.c_str()); std::string src_dir; if (fin && cmSystemTools::GetLineFromStream(fin, src_dir) && @@ -2185,7 +2185,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) cmSystemToolsCMakeRoot = src_dir; } else { dir = cmSystemTools::GetFilenamePath(dir); - src_dir_txt = dir + "/CMakeFiles/CMakeSourceDir.txt"; + src_dir_txt = cmStrCat(dir, "/CMakeFiles/CMakeSourceDir.txt"); cmsys::ifstream fin2(src_dir_txt.c_str()); if (fin2 && cmSystemTools::GetLineFromStream(fin2, src_dir) && cmSystemTools::FileIsDirectory(src_dir)) { |