1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
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
15 #include "cmCommand.h"
17 /** \class cmFindCommon
18 * \brief Base class for FIND_XXX implementations.
20 * cmFindCommon is a parent class for cmFindBase,
21 * cmFindProgramCommand, cmFindPathCommand, cmFindLibraryCommand,
22 * cmFindFileCommand, and cmFindPackageCommand.
24 class cmFindCommon : public cmCommand
29 cmTypeMacro(cmFindCommon, cmCommand);
33 enum RootPathMode { RootPathModeBoth,
34 RootPathModeOnlyRootPath,
35 RootPathModeNoRootPath };
37 enum PathType { FullPath, CMakePath, EnvPath };
39 /** Place a set of search paths under the search roots. */
40 void RerootPaths(std::vector<std::string>& paths);
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);
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);
50 /** Compute final search path list (reroot + trailing slash). */
51 void ComputeFinalPaths();
53 /** Compute the current default root path mode. */
54 void SelectDefaultRootPathMode();
56 /** Compute the current default bundle/framework search policy. */
57 void SelectDefaultMacMode();
59 virtual void GenerateDocumentation();
61 cmStdString CMakePathName;
62 RootPathMode FindRootPathMode;
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,
72 void AddPathInternal(std::string const& in_path, PathType pathType);
74 void SetMakefile(cmMakefile* makefile);
78 bool NoCMakeEnvironmentPath;
79 bool NoSystemEnvironmentPath;
80 bool NoCMakeSystemPath;
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;
88 std::string GenericDocumentationMacPolicy;
89 std::string GenericDocumentationRootPath;
90 std::string GenericDocumentationPathsOrder;
92 bool SearchFrameworkFirst;
93 bool SearchFrameworkOnly;
94 bool SearchFrameworkLast;
96 bool SearchAppBundleFirst;
97 bool SearchAppBundleOnly;
98 bool SearchAppBundleLast;