summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-11-12 15:47:28 (GMT)
committerBrad King <brad.king@kitware.com>2010-11-12 15:47:28 (GMT)
commit5303fbf09ebf3ca18983bf2c556767d16a4ff677 (patch)
treedff2c0396ce5c2dab01861308802e1ee08948dd5 /Source/cmFindPackageCommand.cxx
parente6975fe82fc682a47739f3fad695610f045447ae (diff)
downloadCMake-5303fbf09ebf3ca18983bf2c556767d16a4ff677.zip
CMake-5303fbf09ebf3ca18983bf2c556767d16a4ff677.tar.gz
CMake-5303fbf09ebf3ca18983bf2c556767d16a4ff677.tar.bz2
Speedup find_* commands (#11412)
Delay computation of the command documentation until it is needed. It is wasteful to do it in the constructor on every call. Inspired-By: Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index ef0197a..fdc1a01 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -51,13 +51,6 @@ void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
//----------------------------------------------------------------------------
cmFindPackageCommand::cmFindPackageCommand()
{
- cmSystemTools::ReplaceString(this->GenericDocumentationRootPath,
- "CMAKE_FIND_ROOT_PATH_MODE_XXX",
- "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE");
- cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
- "FIND_ARGS_XXX", "<package>");
- cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
- "FIND_XXX", "find_package");
this->CMakePathName = "PACKAGE";
this->Quiet = false;
this->Required = false;
@@ -78,6 +71,19 @@ cmFindPackageCommand::cmFindPackageCommand()
this->VersionFoundPatch = 0;
this->VersionFoundTweak = 0;
this->VersionFoundCount = 0;
+}
+
+//----------------------------------------------------------------------------
+void cmFindPackageCommand::GenerateDocumentation()
+{
+ this->cmFindCommon::GenerateDocumentation();
+ cmSystemTools::ReplaceString(this->GenericDocumentationRootPath,
+ "CMAKE_FIND_ROOT_PATH_MODE_XXX",
+ "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE");
+ cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
+ "FIND_ARGS_XXX", "<package>");
+ cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
+ "FIND_XXX", "find_package");
this->CommandDocumentation =
" find_package(<package> [version] [EXACT] [QUIET]\n"
" [[REQUIRED|COMPONENTS] [components...]]\n"
@@ -318,6 +324,10 @@ cmFindPackageCommand::cmFindPackageCommand()
//----------------------------------------------------------------------------
const char* cmFindPackageCommand::GetFullDocumentation()
{
+ if(this->CommandDocumentation.empty())
+ {
+ this->GenerateDocumentation();
+ }
return this->CommandDocumentation.c_str();
}