diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDocumentation.cxx | 10 | ||||
-rw-r--r-- | Source/cmDocumentation.h | 5 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 4 |
3 files changed, 11 insertions, 8 deletions
diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 168774a..359833c 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -217,8 +217,7 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os) bool cmDocumentation::CreateModulesSection() { this->ModulesSection.push_back(cmDocumentationModulesHeader[0]); -#ifdef CMAKE_ROOT_DIR - std::string cmakeModules = CMAKE_ROOT_DIR; + std::string cmakeModules = this->CMakeRoot; cmakeModules += "/Modules"; cmsys::Directory dir; dir.Load(cmakeModules.c_str()); @@ -237,7 +236,6 @@ bool cmDocumentation::CreateModulesSection() } } } -#endif cmDocumentationEntry e = { 0, 0, 0 }; this->ModulesSection.push_back(e); return true; @@ -997,8 +995,7 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os) os << "Argument --help-module needs a module name.\n"; return false; } -#ifdef CMAKE_ROOT_DIR - std::string cmakeModules = CMAKE_ROOT_DIR; + std::string cmakeModules = this->CMakeRoot; cmakeModules += "/Modules/"; cmakeModules += this->SingleModuleName; cmakeModules += ".cmake"; @@ -1007,12 +1004,13 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os) this->SingleModuleName.c_str())) { this->PrintDocumentationCommand(os, &this->ModulesSection[0]); + os << "\n Defined in: "; + os << cmakeModules << "\n"; return true; } // Argument was not a module. Complain. os << "Argument \"" << this->SingleModuleName.c_str() << "\" to --help-module is not a CMake module."; -#endif return false; } diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 735d09c..6ce777e 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -96,6 +96,9 @@ public: /** Clear all previously added sections of help. */ void ClearSections(); + + /** Set cmake root so we can find installed files */ + void SetCMakeRoot(const char* root) { this->CMakeRoot = root;} private: void PrintSection(std::ostream& os, const cmDocumentationEntry* section, @@ -161,7 +164,7 @@ private: std::string SeeAlsoString; std::string SingleCommand; std::string SingleModuleName; - + std::string CMakeRoot; std::vector< char* > ModuleStrings; std::vector< const char* > Names; std::vector< const cmDocumentationEntry* > Sections; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index a3bb75c..f607282 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -141,9 +141,11 @@ int do_cmake(int ac, char** av) #ifdef CMAKE_BUILD_WITH_CMAKE if(doc.CheckOptions(ac, av) || nocwd) - { + { // Construct and print requested documentation. cmake hcm; + hcm.AddCMakePaths(av[0]); + doc.SetCMakeRoot(hcm.GetCacheDefinition("CMAKE_ROOT")); std::vector<cmDocumentationEntry> commands; std::vector<cmDocumentationEntry> generators; hcm.GetCommandDocumentation(commands); |