Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / Source / cmFindBase.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmFindBase_h
13 #define cmFindBase_h
14
15 #include "cmFindCommon.h"
16
17 /** \class cmFindBase
18  * \brief Base class for most FIND_XXX commands.
19  *
20  * cmFindBase is a parent class for cmFindProgramCommand, cmFindPathCommand,
21  * and cmFindLibraryCommand, cmFindFileCommand
22  */
23 class cmFindBase : public cmFindCommon
24 {
25 public:
26   cmFindBase();
27   /**
28    * This is called when the command is first encountered in
29    * the CMakeLists.txt file.
30    */
31   virtual bool ParseArguments(std::vector<std::string> const& args);
32   cmTypeMacro(cmFindBase, cmFindCommon);
33
34   virtual const char* GetFullDocumentation() const;
35
36 protected:
37   virtual void GenerateDocumentation();
38   void PrintFindStuff();
39   void ExpandPaths();
40   void AddPathSuffixes();
41
42   // see if the VariableName is already set in the cache,
43   // also copy the documentation from the cache to VariableDocumentation
44   // if it has documentation in the cache
45   bool CheckForVariableInCache();
46
47   cmStdString GenericDocumentation;
48   // use by command during find
49   cmStdString VariableDocumentation;
50   cmStdString VariableName;
51   std::vector<std::string> Names;
52   bool NamesPerDir;
53   bool NamesPerDirAllowed;
54
55   // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM
56   cmStdString EnvironmentPath; // LIB,INCLUDE
57
58   bool AlreadyInCache;
59   bool AlreadyInCacheWithoutMetaInfo;
60 private:
61   // Add pieces of the search.
62   void AddCMakeEnvironmentPath();
63   void AddCMakeVariablePath();
64   void AddSystemEnvironmentPath();
65   void AddCMakeSystemVariablePath();
66   void AddUserHintsPath();
67   void AddUserGuessPath();
68
69   // Helpers.
70   void AddCMakePrefixPath(const char* variable);
71   void AddEnvPrefixPath(const char* variable);
72   void AddPrefixPaths(std::vector<std::string> const& in_paths,
73                       PathType pathType);
74 };
75
76
77
78 #endif