summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-17 14:02:31 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-17 14:02:31 (GMT)
commitb424df917dc14ea7376940c6c22a3a274aedcc2b (patch)
treec29fc8171c1a13c74746dd2e28e10016614e16cb /Source/cmFindPackageCommand.h
parent491d5d01049e515fa5317f943d9e48ff531f69a6 (diff)
downloadCMake-b424df917dc14ea7376940c6c22a3a274aedcc2b.zip
CMake-b424df917dc14ea7376940c6c22a3a274aedcc2b.tar.gz
CMake-b424df917dc14ea7376940c6c22a3a274aedcc2b.tar.bz2
ENH: Major improvements to the FIND_PACKAGE command. See bug #3659.
- Use CMAKE_PREFIX_PATH and CMAKE_SYSTEM_PREFIX_PATH among other means to locate package configuration files. - Create cmFindCommon as base for cmFindBase and cmFindPackageCommand - Move common functionality up to cmFindCommon - Improve documentation of FIND_* commands. - Fix FIND_* commands to not add framework/app paths in wrong place.
Diffstat (limited to 'Source/cmFindPackageCommand.h')
-rw-r--r--Source/cmFindPackageCommand.h78
1 files changed, 38 insertions, 40 deletions
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 26c6090..af41048 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -17,16 +17,20 @@
#ifndef cmFindPackageCommand_h
#define cmFindPackageCommand_h
-#include "cmCommand.h"
+#include "cmFindCommon.h"
+
+class cmFindPackageFileList;
/** \class cmFindPackageCommand
* \brief Load settings from an external project.
*
* cmFindPackageCommand
*/
-class cmFindPackageCommand : public cmCommand
+class cmFindPackageCommand : public cmFindCommon
{
public:
+ cmFindPackageCommand();
+
/**
* This is a virtual constructor for the command.
*/
@@ -62,51 +66,45 @@ public:
/**
* More documentation.
*/
- virtual const char* GetFullDocumentation()
- {
- return
- " find_package(<name> [major.minor] [QUIET] [NO_MODULE]\n"
- " [[REQUIRED|COMPONENTS] [components...]])\n"
- "Finds and loads settings from an external project. <name>_FOUND will "
- "be set to indicate whether the package was found. Settings that "
- "can be used when <name>_FOUND is true are package-specific. The "
- "package is found through several steps. "
- "Directories listed in CMAKE_MODULE_PATH are searched for files called "
- "\"Find<name>.cmake\". If such a file is found, it is read and "
- "processed by CMake, and is responsible for finding the package. "
- "This first step may be skipped by using the NO_MODULE option. "
- "If no such file is found, it is expected that the package is another "
- "project built by CMake that has a \"<name>Config.cmake\" file. "
- "A cache entry called <name>_DIR is created and is expected to be set "
- "to the directory containing this file. If the file is found, it is "
- "read and processed by CMake to load the settings of the package. If "
- "<name>_DIR has not been set during a configure step, the command "
- "will generate an error describing the problem unless the QUIET "
- "argument is specified. If <name>_DIR has been set to a directory "
- "not containing a \"<name>Config.cmake\" file, an error is always "
- "generated. If REQUIRED is specified and the package is not found, "
- "a FATAL_ERROR is generated and the configure step stops executing. "
- "A package-specific list of components may be listed after the "
- "REQUIRED option, or after the COMPONENTS option if no REQUIRED "
- "option is given.";
- }
+ virtual const char* GetFullDocumentation();
- cmTypeMacro(cmFindPackageCommand, cmCommand);
+ cmTypeMacro(cmFindPackageCommand, cmFindCommon);
private:
- void AppendSuccessInformation(bool quiet);
+ void AppendSuccessInformation();
void AppendToProperty(const char* propertyName);
- bool FindModule(bool& found, bool quiet, bool required);
- bool FindConfig();
- std::string SearchForConfig() const;
+ bool FindModule(bool& found);
+ bool HandlePackageMode();
+ void FindConfig();
+ bool FindPrefixedConfig();
+ bool FindFrameworkConfig();
+ bool FindAppBundleConfig();
bool ReadListFile(const char* f);
+ void AddUserPath(std::string const& p);
+ void ComputePrefixes();
+ bool SearchDirectory(std::string const& dir);
+ bool CheckDirectory(std::string const& dir);
+ bool FindConfigFile(std::string const& dir, std::string& file);
+ bool SearchPrefix(std::string const& prefix);
+ bool SearchFrameworkPrefix(std::string const& prefix_in);
+ bool SearchAppBundlePrefix(std::string const& prefix_in);
+
+ friend class cmFindPackageFileList;
+
+ std::string CommandDocumentation;
cmStdString Name;
cmStdString Variable;
- cmStdString Config;
- std::vector<cmStdString> Builds;
- std::vector<cmStdString> Prefixes;
- std::vector<cmStdString> Relatives;
+ cmStdString FileFound;
+ bool Quiet;
+ bool Required;
+ bool Compatibility_1_6;
+ bool NoModule;
+ bool NoBuilds;
+ bool DebugMode;
+ std::vector<std::string> Names;
+ std::vector<std::string> Configs;
+ std::vector<std::string> Prefixes;
+ std::vector<std::string> UserPaths;
};
-
#endif