1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmFindPackageCommand.h,v $
6 Date: $Date: 2008-09-10 14:11:48 $
7 Version: $Revision: 1.25 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmFindPackageCommand_h
18 #define cmFindPackageCommand_h
20 #include "cmFindCommon.h"
22 class cmFindPackageFileList
;
24 /** \class cmFindPackageCommand
25 * \brief Load settings from an external project.
27 * cmFindPackageCommand
29 class cmFindPackageCommand
: public cmFindCommon
32 cmFindPackageCommand();
35 * This is a virtual constructor for the command.
37 virtual cmCommand
* Clone()
39 return new cmFindPackageCommand
;
43 * This is called when the command is first encountered in
44 * the CMakeLists.txt file.
46 virtual bool InitialPass(std::vector
<std::string
> const& args
,
47 cmExecutionStatus
&status
);
50 * This determines if the command is invoked when in script mode.
52 virtual bool IsScriptable() { return true; }
55 * The name of the command as specified in CMakeList.txt.
57 virtual const char* GetName() { return "find_package";}
60 * Succinct documentation.
62 virtual const char* GetTerseDocumentation()
64 return "Load settings for an external project.";
70 virtual const char* GetFullDocumentation();
72 cmTypeMacro(cmFindPackageCommand
, cmFindCommon
);
74 void AppendSuccessInformation();
75 void AppendToProperty(const char* propertyName
);
76 void SetModuleVariables(const std::string
& components
);
77 bool FindModule(bool& found
);
78 bool HandlePackageMode();
80 bool FindPrefixedConfig();
81 bool FindFrameworkConfig();
82 bool FindAppBundleConfig();
83 bool ReadListFile(const char* f
);
84 void StoreVersionFound();
86 void ComputePrefixes();
87 void AddPrefixesCMakeEnvironment();
88 void AddPrefixesCMakeVariable();
89 void AddPrefixesSystemEnvironment();
90 void AddPrefixesBuilds();
91 void AddPrefixesCMakeSystemVariable();
92 void AddPrefixesUserGuess();
93 void AddPrefixesUserHints();
94 void ComputeFinalPrefixes();
95 bool SearchDirectory(std::string
const& dir
);
96 bool CheckDirectory(std::string
const& dir
);
97 bool FindConfigFile(std::string
const& dir
, std::string
& file
);
98 bool FindConfigFileToLoad(std::string
const& dir
, std::string
& file
);
99 bool CheckVersion(std::string
const& config_file
);
100 bool CheckVersionFile(std::string
const& version_file
);
101 bool SearchPrefix(std::string
const& prefix
);
102 bool SearchFrameworkPrefix(std::string
const& prefix_in
);
103 bool SearchAppBundlePrefix(std::string
const& prefix_in
);
105 friend class cmFindPackageFileList
;
107 std::string CommandDocumentation
;
109 cmStdString Variable
;
111 unsigned int VersionMajor
;
112 unsigned int VersionMinor
;
113 unsigned int VersionPatch
;
114 unsigned int VersionTweak
;
115 unsigned int VersionCount
;
117 cmStdString FileFound
;
118 cmStdString VersionFound
;
119 unsigned int VersionFoundMajor
;
120 unsigned int VersionFoundMinor
;
121 unsigned int VersionFoundPatch
;
122 unsigned int VersionFoundTweak
;
123 unsigned int VersionFoundCount
;
126 bool Compatibility_1_6
;
131 std::vector
<std::string
> Names
;
132 std::vector
<std::string
> Configs
;