cmFindBase.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmFindBase_h
  14. #define cmFindBase_h
  15. #include "cmCommand.h"
  16. /** \class cmFindBase
  17. * \brief Define a command to search for an executable program.
  18. *
  19. * cmFindBase is a parent class for cmFindProgramCommand, cmFindPathCommand,
  20. * and cmFindLibraryCommand, cmFindFile
  21. */
  22. class cmFindBase : public cmCommand
  23. {
  24. public:
  25. cmFindBase();
  26. /**
  27. * This is called when the command is first encountered in
  28. * the CMakeLists.txt file.
  29. */
  30. virtual bool ParseArguments(std::vector<std::string> const& args);
  31. cmTypeMacro(cmFindBase, cmCommand);
  32. virtual const char* GetFullDocumentation()
  33. {return this->GenericDocumentation.c_str();}
  34. enum RootPathMode { RootPathModeBoth,
  35. RootPathModeOnlyRootPath,
  36. RootPathModeNoRootPath };
  37. protected:
  38. void PrintFindStuff();
  39. void ExpandPaths(std::vector<std::string> userPaths);
  40. void HandleCMakeFindRootPath();
  41. // add to the SearchPaths
  42. void AddPaths(std::vector<std::string>& paths);
  43. void AddFrameWorkPaths();
  44. void AddAppBundlePaths();
  45. void AddEnvironmentVariables();
  46. void AddFindPrefix(std::vector<std::string>& dest,
  47. const std::vector<std::string>& src);
  48. void AddCMakeVariables();
  49. void AddSystemEnvironmentVariables();
  50. void AddCMakeSystemVariables();
  51. void ExpandRegistryAndCleanPath(std::vector<std::string>& paths);
  52. // see if the VariableName is already set in the cache,
  53. // also copy the documentation from the cache to VariableDocumentation
  54. // if it has documentation in the cache
  55. bool CheckForVariableInCache();
  56. cmStdString GenericDocumentation;
  57. // use by command during find
  58. cmStdString VariableDocumentation;
  59. cmStdString VariableName;
  60. std::vector<std::string> Names;
  61. std::vector<std::string> SearchPaths;
  62. std::vector<std::string> SearchPathSuffixes;
  63. // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM
  64. cmStdString CMakePathName;
  65. cmStdString EnvironmentPath; // LIB,INCLUDE
  66. bool AlreadyInCache;
  67. bool AlreadyInCacheWithoutMetaInfo;
  68. bool NoDefaultPath;
  69. bool NoCMakePath;
  70. bool NoCMakeEnvironmentPath;
  71. bool NoSystemEnvironmentPath;
  72. bool NoCMakeSystemPath;
  73. RootPathMode FindRootPathMode;
  74. bool SearchFrameworkFirst;
  75. bool SearchFrameworkOnly;
  76. bool SearchFrameworkLast;
  77. bool SearchAppBundleFirst;
  78. bool SearchAppBundleOnly;
  79. bool SearchAppBundleLast;
  80. };
  81. #endif