packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmFindCommon.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 cmFindCommon_h
13 #define cmFindCommon_h
14
15 #include "cmCommand.h"
16
17 /** \class cmFindCommon
18  * \brief Base class for FIND_XXX implementations.
19  *
20  * cmFindCommon is a parent class for cmFindBase,
21  * cmFindProgramCommand, cmFindPathCommand, cmFindLibraryCommand,
22  * cmFindFileCommand, and cmFindPackageCommand.
23  */
24 class cmFindCommon : public cmCommand
25 {
26 public:
27   cmFindCommon();
28   ~cmFindCommon();
29   cmTypeMacro(cmFindCommon, cmCommand);
30
31 protected:
32
33   enum RootPathMode { RootPathModeBoth,
34                       RootPathModeOnlyRootPath,
35                       RootPathModeNoRootPath };
36
37   enum PathType { FullPath, CMakePath, EnvPath };
38
39   /** Place a set of search paths under the search roots.  */
40   void RerootPaths(std::vector<std::string>& paths);
41
42   /** Get ignored paths from CMAKE_[SYSTEM_]IGNORE_path variables.  */
43   void GetIgnoredPaths(std::vector<std::string>& ignore);
44   void GetIgnoredPaths(std::set<std::string>& ignore);
45
46   /** Remove paths in the ignore set from the supplied vector.  */
47   void FilterPaths(std::vector<std::string>& paths,
48                    const std::set<std::string>& ignore);
49
50   /** Compute final search path list (reroot + trailing slash).  */
51   void ComputeFinalPaths();
52
53   /** Compute the current default root path mode.  */
54   void SelectDefaultRootPathMode();
55
56   /** Compute the current default bundle/framework search policy.  */
57   void SelectDefaultMacMode();
58
59   virtual void GenerateDocumentation();
60
61   cmStdString CMakePathName;
62   RootPathMode FindRootPathMode;
63
64   bool CheckCommonArgument(std::string const& arg);
65   void AddPathSuffix(std::string const& arg);
66   void AddUserPath(std::string const& p,
67                    std::vector<std::string>& paths);
68   void AddCMakePath(const char* variable);
69   void AddEnvPath(const char* variable);
70   void AddPathsInternal(std::vector<std::string> const& in_paths,
71                         PathType pathType);
72   void AddPathInternal(std::string const& in_path, PathType pathType);
73
74   void SetMakefile(cmMakefile* makefile);
75
76   bool NoDefaultPath;
77   bool NoCMakePath;
78   bool NoCMakeEnvironmentPath;
79   bool NoSystemEnvironmentPath;
80   bool NoCMakeSystemPath;
81
82   std::vector<std::string> SearchPathSuffixes;
83   std::vector<std::string> UserPaths;
84   std::vector<std::string> UserHints;
85   std::vector<std::string> SearchPaths;
86   std::set<cmStdString> SearchPathsEmitted;
87
88   std::string GenericDocumentationMacPolicy;
89   std::string GenericDocumentationRootPath;
90   std::string GenericDocumentationPathsOrder;
91
92   bool SearchFrameworkFirst;
93   bool SearchFrameworkOnly;
94   bool SearchFrameworkLast;
95
96   bool SearchAppBundleFirst;
97   bool SearchAppBundleOnly;
98   bool SearchAppBundleLast;
99 };
100
101 #endif