diff options
author | Brad King <brad.king@kitware.com> | 2010-11-12 15:47:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-11-12 15:47:28 (GMT) |
commit | 5303fbf09ebf3ca18983bf2c556767d16a4ff677 (patch) | |
tree | dff2c0396ce5c2dab01861308802e1ee08948dd5 /Source/cmFindPathCommand.cxx | |
parent | e6975fe82fc682a47739f3fad695610f045447ae (diff) | |
download | CMake-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/cmFindPathCommand.cxx')
-rw-r--r-- | Source/cmFindPathCommand.cxx | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index cca243a..83b651b 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -18,6 +18,11 @@ cmFindPathCommand::cmFindPathCommand() { this->EnvironmentPath = "INCLUDE"; this->IncludeFileInPath = false; +} + +void cmFindPathCommand::GenerateDocumentation() +{ + this->cmFindBase::GenerateDocumentation(); cmSystemTools::ReplaceString(this->GenericDocumentation, "FIND_XXX", "find_path"); cmSystemTools::ReplaceString(this->GenericDocumentation, @@ -31,27 +36,21 @@ cmFindPathCommand::cmFindPathCommand() cmSystemTools::ReplaceString(this->GenericDocumentation, "XXX_SYSTEM", "INCLUDE"); cmSystemTools::ReplaceString(this->GenericDocumentation, - "CMAKE_SYSTEM_XXX_PATH", - "CMAKE_SYSTEM_INCLUDE_PATH"); + "CMAKE_SYSTEM_XXX_PATH", + "CMAKE_SYSTEM_INCLUDE_PATH"); cmSystemTools::ReplaceString(this->GenericDocumentation, - "SEARCH_XXX_DESC", + "SEARCH_XXX_DESC", "directory containing the named file"); cmSystemTools::ReplaceString(this->GenericDocumentation, "SEARCH_XXX", "file in a directory"); cmSystemTools::ReplaceString(this->GenericDocumentation, "XXX_SUBDIR", "include"); cmSystemTools::ReplaceString(this->GenericDocumentation, - "CMAKE_FIND_ROOT_PATH_MODE_XXX", + "CMAKE_FIND_ROOT_PATH_MODE_XXX", "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"); - - this->ExtraDocAdded = false; -} - -const char* cmFindPathCommand::GetFullDocumentation() -{ - if(!this->ExtraDocAdded && !this->IncludeFileInPath) + if(!this->IncludeFileInPath) { - this->GenericDocumentation += + this->GenericDocumentation += "\n" "When searching for frameworks, if the file is specified as " "A/b.h, then the framework search will look for " @@ -59,9 +58,7 @@ const char* cmFindPathCommand::GetFullDocumentation() "If that is found the path will be set to the path to the framework. " "CMake will convert this to the correct -F option to include the " "file. "; - this->ExtraDocAdded = true; } - return this->GenericDocumentation.c_str(); } // cmFindPathCommand |