cmFindCommon.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmFindCommon_h
  11. #define cmFindCommon_h
  12. #include "cmCommand.h"
  13. /** \class cmFindCommon
  14. * \brief Base class for FIND_XXX implementations.
  15. *
  16. * cmFindCommon is a parent class for cmFindBase,
  17. * cmFindProgramCommand, cmFindPathCommand, cmFindLibraryCommand,
  18. * cmFindFileCommand, and cmFindPackageCommand.
  19. */
  20. class cmFindCommon : public cmCommand
  21. {
  22. public:
  23. cmFindCommon();
  24. ~cmFindCommon();
  25. cmTypeMacro(cmFindCommon, cmCommand);
  26. protected:
  27. enum RootPathMode { RootPathModeBoth,
  28. RootPathModeOnlyRootPath,
  29. RootPathModeNoRootPath };
  30. enum PathType { FullPath, CMakePath, EnvPath };
  31. /** Place a set of search paths under the search roots. */
  32. void RerootPaths(std::vector<std::string>& paths);
  33. /** Get ignored paths from CMAKE_[SYSTEM_]IGNORE_path variables. */
  34. void GetIgnoredPaths(std::vector<std::string>& ignore);
  35. void GetIgnoredPaths(std::set<std::string>& ignore);
  36. /** Remove paths in the ignore set from the supplied vector. */
  37. void FilterPaths(std::vector<std::string>& paths,
  38. const std::set<std::string>& ignore);
  39. /** Compute final search path list (reroot + trailing slash). */
  40. void ComputeFinalPaths();
  41. /** Compute the current default root path mode. */
  42. void SelectDefaultRootPathMode();
  43. /** Compute the current default bundle/framework search policy. */
  44. void SelectDefaultMacMode();
  45. cmStdString CMakePathName;
  46. RootPathMode FindRootPathMode;
  47. bool CheckCommonArgument(std::string const& arg);
  48. void AddPathSuffix(std::string const& arg);
  49. void AddUserPath(std::string const& p,
  50. std::vector<std::string>& paths);
  51. void AddCMakePath(const char* variable);
  52. void AddEnvPath(const char* variable);
  53. void AddPathsInternal(std::vector<std::string> const& in_paths,
  54. PathType pathType);
  55. void AddPathInternal(std::string const& in_path, PathType pathType);
  56. void SetMakefile(cmMakefile* makefile);
  57. bool NoDefaultPath;
  58. bool NoCMakePath;
  59. bool NoCMakeEnvironmentPath;
  60. bool NoSystemEnvironmentPath;
  61. bool NoCMakeSystemPath;
  62. std::vector<std::string> SearchPathSuffixes;
  63. std::vector<std::string> UserPaths;
  64. std::vector<std::string> UserHints;
  65. std::vector<std::string> SearchPaths;
  66. std::set<cmStdString> SearchPathsEmitted;
  67. bool SearchFrameworkFirst;
  68. bool SearchFrameworkOnly;
  69. bool SearchFrameworkLast;
  70. bool SearchAppBundleFirst;
  71. bool SearchAppBundleOnly;
  72. bool SearchAppBundleLast;
  73. };
  74. #endif