summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx28
1 files changed, 22 insertions, 6 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 1e625a4..97440d2 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2077,6 +2077,7 @@ static std::string cmSystemToolsCMakeCursesCommand;
static std::string cmSystemToolsCMakeGUICommand;
static std::string cmSystemToolsCMClDepsCommand;
static std::string cmSystemToolsCMakeRoot;
+static std::string cmSystemToolsHTMLDoc;
void cmSystemTools::FindCMakeResources(const char* argv0)
{
std::string exe_dir;
@@ -2166,18 +2167,23 @@ 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)) {
+ // - "<prefix><CMAKE_DOC_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 (cmSystemTools::FileExists(
+ cmStrCat(prefix, CMAKE_DOC_DIR "/html/index.html"))) {
+ cmSystemToolsHTMLDoc = cmStrCat(prefix, CMAKE_DOC_DIR "/html");
+ }
}
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,13 +2191,18 @@ 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)) {
cmSystemToolsCMakeRoot = src_dir;
}
}
+ if (!cmSystemToolsCMakeRoot.empty() && cmSystemToolsHTMLDoc.empty() &&
+ cmSystemTools::FileExists(
+ cmStrCat(dir, "/Utilities/Sphinx/html/index.html"))) {
+ cmSystemToolsHTMLDoc = cmStrCat(dir, "/Utilities/Sphinx/html");
+ }
}
#else
// Bootstrap build knows its source.
@@ -2234,6 +2245,11 @@ std::string const& cmSystemTools::GetCMakeRoot()
return cmSystemToolsCMakeRoot;
}
+std::string const& cmSystemTools::GetHTMLDoc()
+{
+ return cmSystemToolsHTMLDoc;
+}
+
std::string cmSystemTools::GetCurrentWorkingDirectory()
{
return cmSystemTools::CollapseFullPath(