diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 68 | ||||
-rw-r--r-- | Source/cmake.cxx | 26 |
2 files changed, 94 insertions, 0 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 518d3a9..364b64c 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -124,10 +124,12 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) bool foundModule = false; if(!this->FindModule(foundModule, quiet, required)) { + this->AppendSuccessInformation(quiet); return false; } if(foundModule) { + this->AppendSuccessInformation(quiet); return true; } } @@ -172,6 +174,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) { if(!this->FindConfig()) { + this->AppendSuccessInformation(quiet); return false; } } @@ -272,6 +275,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) } #endif + this->AppendSuccessInformation(quiet); return result; } @@ -435,3 +439,67 @@ bool cmFindPackageCommand::ReadListFile(const char* f) this->SetError(e.c_str()); return false; } + +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AppendToProperty(const char* propertyName) +{ + std::string propertyValue; + const char *prop = + this->Makefile->GetCMakeInstance()->GetProperty(propertyName); + if (prop && *prop) + { + propertyValue = prop; + + std::vector<std::string> contents; + cmSystemTools::ExpandListArgument(propertyValue, contents, false); + + bool alreadyInserted = false; + for(std::vector<std::string>::const_iterator it = contents.begin(); + it != contents.end(); ++ it ) + { + if (*it == this->Name) + { + alreadyInserted = true; + break; + } + } + if (!alreadyInserted) + { + propertyValue += ";"; + propertyValue += this->Name; + } + } + else + { + propertyValue = this->Name; + } + this->Makefile->GetCMakeInstance()->SetProperty(propertyName, + propertyValue.c_str()); + } + +//---------------------------------------------------------------------------- +void cmFindPackageCommand::AppendSuccessInformation(bool quiet) +{ + std::string found = this->Name; + found += "_FOUND"; + std::string upperFound = cmSystemTools::UpperCase(found); + + const char* upperResult = this->Makefile->GetDefinition(upperFound.c_str()); + const char* result = this->Makefile->GetDefinition(found.c_str()); + if ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult))) + { + this->AppendToProperty("PACKAGES_FOUND"); + if (!quiet) + { + this->AppendToProperty("ENABLED_FEATURES"); + } + } + else + { + this->AppendToProperty("PACKAGES_NOT_FOUND"); + if (!quiet) + { + this->AppendToProperty("DISABLED_FEATURES"); + } + } +} diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 17b04e1..8e7179e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -3044,6 +3044,32 @@ void cmake::DefineProperties(cmake *cm) "FIND_LIBRARY command should automatically search the lib64 variant of " "directories called lib in the search path when building 64-bit " "binaries."); + cm->DefineProperty + ("ENABLED_FEATURES", cmProperty::GLOBAL, + "List of features which are enabled during the CMake run.", + "List of features which are enabled during the CMake run. Be default " + "it contains the names of all packages which were found. This is " + "determined using the <NAME>_FOUND variables. Packages which are " + "searched QUIET are not listed. A project can add its own features to " + "this list.This property is used by the macros in FeatureSummary.cmake."); + cm->DefineProperty + ("DISABLED_FEATURES", cmProperty::GLOBAL, + "List of features which are disabled during the CMake run.", + "List of features which are disabled during the CMake run. Be default " + "it contains the names of all packages which were not found. This is " + "determined using the <NAME>_FOUND variables. Packages which are " + "searched QUIET are not listed. A project can add its own features to " + "this list.This property is used by the macros in FeatureSummary.cmake."); + cm->DefineProperty + ("PACKAGES_FOUND", cmProperty::GLOBAL, + "List of packages which were found during the CMake run.", + "List of packages which were found during the CMake run. Whether a " + "package has been found is determined using the <NAME>_FOUND variables."); + cm->DefineProperty + ("PACKAGES_NOT_FOUND", cmProperty::GLOBAL, + "List of packages which were not found during the CMake run.", + "List of packages which were not found during the CMake run. Whether a " + "package has been found is determined using the <NAME>_FOUND variables."); } |