ENH: search for help modules in the correct place for install and source tree builds
This commit is contained in:
parent
ac242e319b
commit
96a46bdb44
|
@ -217,8 +217,7 @@ bool cmDocumentation::PrintDocumentation(Type ht, std::ostream& os)
|
||||||
bool cmDocumentation::CreateModulesSection()
|
bool cmDocumentation::CreateModulesSection()
|
||||||
{
|
{
|
||||||
this->ModulesSection.push_back(cmDocumentationModulesHeader[0]);
|
this->ModulesSection.push_back(cmDocumentationModulesHeader[0]);
|
||||||
#ifdef CMAKE_ROOT_DIR
|
std::string cmakeModules = this->CMakeRoot;
|
||||||
std::string cmakeModules = CMAKE_ROOT_DIR;
|
|
||||||
cmakeModules += "/Modules";
|
cmakeModules += "/Modules";
|
||||||
cmsys::Directory dir;
|
cmsys::Directory dir;
|
||||||
dir.Load(cmakeModules.c_str());
|
dir.Load(cmakeModules.c_str());
|
||||||
|
@ -237,7 +236,6 @@ bool cmDocumentation::CreateModulesSection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
cmDocumentationEntry e = { 0, 0, 0 };
|
cmDocumentationEntry e = { 0, 0, 0 };
|
||||||
this->ModulesSection.push_back(e);
|
this->ModulesSection.push_back(e);
|
||||||
return true;
|
return true;
|
||||||
|
@ -997,8 +995,7 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os)
|
||||||
os << "Argument --help-module needs a module name.\n";
|
os << "Argument --help-module needs a module name.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef CMAKE_ROOT_DIR
|
std::string cmakeModules = this->CMakeRoot;
|
||||||
std::string cmakeModules = CMAKE_ROOT_DIR;
|
|
||||||
cmakeModules += "/Modules/";
|
cmakeModules += "/Modules/";
|
||||||
cmakeModules += this->SingleModuleName;
|
cmakeModules += this->SingleModuleName;
|
||||||
cmakeModules += ".cmake";
|
cmakeModules += ".cmake";
|
||||||
|
@ -1007,12 +1004,13 @@ bool cmDocumentation::PrintDocumentationSingleModule(std::ostream& os)
|
||||||
this->SingleModuleName.c_str()))
|
this->SingleModuleName.c_str()))
|
||||||
{
|
{
|
||||||
this->PrintDocumentationCommand(os, &this->ModulesSection[0]);
|
this->PrintDocumentationCommand(os, &this->ModulesSection[0]);
|
||||||
|
os << "\n Defined in: ";
|
||||||
|
os << cmakeModules << "\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Argument was not a module. Complain.
|
// Argument was not a module. Complain.
|
||||||
os << "Argument \"" << this->SingleModuleName.c_str()
|
os << "Argument \"" << this->SingleModuleName.c_str()
|
||||||
<< "\" to --help-module is not a CMake module.";
|
<< "\" to --help-module is not a CMake module.";
|
||||||
#endif
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,9 @@ public:
|
||||||
|
|
||||||
/** Clear all previously added sections of help. */
|
/** Clear all previously added sections of help. */
|
||||||
void ClearSections();
|
void ClearSections();
|
||||||
|
|
||||||
|
/** Set cmake root so we can find installed files */
|
||||||
|
void SetCMakeRoot(const char* root) { this->CMakeRoot = root;}
|
||||||
private:
|
private:
|
||||||
void PrintSection(std::ostream& os,
|
void PrintSection(std::ostream& os,
|
||||||
const cmDocumentationEntry* section,
|
const cmDocumentationEntry* section,
|
||||||
|
@ -161,7 +164,7 @@ private:
|
||||||
std::string SeeAlsoString;
|
std::string SeeAlsoString;
|
||||||
std::string SingleCommand;
|
std::string SingleCommand;
|
||||||
std::string SingleModuleName;
|
std::string SingleModuleName;
|
||||||
|
std::string CMakeRoot;
|
||||||
std::vector< char* > ModuleStrings;
|
std::vector< char* > ModuleStrings;
|
||||||
std::vector< const char* > Names;
|
std::vector< const char* > Names;
|
||||||
std::vector< const cmDocumentationEntry* > Sections;
|
std::vector< const cmDocumentationEntry* > Sections;
|
||||||
|
|
|
@ -144,6 +144,8 @@ int do_cmake(int ac, char** av)
|
||||||
{
|
{
|
||||||
// Construct and print requested documentation.
|
// Construct and print requested documentation.
|
||||||
cmake hcm;
|
cmake hcm;
|
||||||
|
hcm.AddCMakePaths(av[0]);
|
||||||
|
doc.SetCMakeRoot(hcm.GetCacheDefinition("CMAKE_ROOT"));
|
||||||
std::vector<cmDocumentationEntry> commands;
|
std::vector<cmDocumentationEntry> commands;
|
||||||
std::vector<cmDocumentationEntry> generators;
|
std::vector<cmDocumentationEntry> generators;
|
||||||
hcm.GetCommandDocumentation(commands);
|
hcm.GetCommandDocumentation(commands);
|
||||||
|
|
Loading…
Reference in New Issue