diff options
author | Brad King <brad.king@kitware.com> | 2006-07-11 21:10:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-07-11 21:10:00 (GMT) |
commit | 6f52ed1c8e2465ea0fe169a6bd6aa1364acf1ca3 (patch) | |
tree | 8c569ccf8980ffc52065c9dc829f5f1b01b15246 /Source/cmFindPackageCommand.cxx | |
parent | 981787c9c5a6f5af8995e6b7f92071f77bb916f9 (diff) | |
download | CMake-6f52ed1c8e2465ea0fe169a6bd6aa1364acf1ca3.zip CMake-6f52ed1c8e2465ea0fe169a6bd6aa1364acf1ca3.tar.gz CMake-6f52ed1c8e2465ea0fe169a6bd6aa1364acf1ca3.tar.bz2 |
ENH: Added creation of XXX_FIND_COMPONENTS list of all components requested with REQUIRED option. This addresses the feature request in bug#3494.
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 00a4c3d..62aaeb2 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -56,6 +56,9 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) this->Name = args[0]; + // Build a list of required components. + std::string components; + const char* components_sep = ""; bool quiet = false; bool required = false; if(args.size() > 1) @@ -74,11 +77,32 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) } else if(args[i] == "REQUIRED") { + // The package is required. required = true; - while (++i < args.size() && args[i] != "QUIET") + + // Look for a list of required components. + while(++i < args.size()) { - std::string req_var = Name + "_FIND_REQUIRED_" + args[i]; - this->Makefile->AddDefinition(req_var.c_str(), "1"); + // Stop looking when a known keyword argument is + // encountered. + if((args[i] == "QUIET") || + (args[i] == "REQUIRED")) + { + --i; + break; + } + else + { + // Set a variable telling the find script this component + // is required. + std::string req_var = Name + "_FIND_REQUIRED_" + args[i]; + this->Makefile->AddDefinition(req_var.c_str(), "1"); + + // Append to the list of required components. + components += components_sep; + components += args[i]; + components_sep = ";"; + } } } else @@ -89,6 +113,10 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) return false; } } + + // Store the list of components. + std::string components_var = Name + "_FIND_COMPONENTS"; + this->Makefile->AddDefinition(components_var.c_str(), components.c_str()); } // See if there is a Find<name>.cmake module. |