cmFindProgramCommand.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 cmFindProgramCommand_h
  14. #define cmFindProgramCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmFindProgramCommand
  17. * \brief Define a command to search for an executable program.
  18. *
  19. * cmFindProgramCommand is used to define a CMake variable
  20. * that specifies an executable program. The command searches
  21. * in the current path (e.g., PATH environment variable) for
  22. * an executable that matches one of the supplied names.
  23. */
  24. class cmFindProgramCommand : public cmCommand
  25. {
  26. public:
  27. /**
  28. * This is a virtual constructor for the command.
  29. */
  30. virtual cmCommand* Clone()
  31. {
  32. return new cmFindProgramCommand;
  33. }
  34. /**
  35. * This is called when the command is first encountered in
  36. * the CMakeLists.txt file.
  37. */
  38. virtual bool InitialPass(std::vector<std::string> const& args);
  39. /**
  40. * This determines if the command gets propagated down
  41. * to makefiles located in subdirectories.
  42. */
  43. virtual bool IsInherited() { return false; }
  44. /**
  45. * This determines if the command is invoked when in script mode.
  46. */
  47. virtual bool IsScriptable() { return true; }
  48. /**
  49. * The name of the command as specified in CMakeList.txt.
  50. */
  51. virtual const char* GetName() { return "FIND_PROGRAM";}
  52. /**
  53. * Succinct documentation.
  54. */
  55. virtual const char* GetTerseDocumentation()
  56. {
  57. return "Find an executable program.";
  58. }
  59. /**
  60. * More documentation.
  61. */
  62. virtual const char* GetFullDocumentation()
  63. {
  64. return
  65. " FIND_PROGRAM(<VAR> NAMES name1 [name2 ...]\n"
  66. " [PATHS path1 path2 ...]\n"
  67. " [NO_SYSTEM_PATH]\n"
  68. " [DOC \"docstring\"])\n"
  69. "Find an executable named by one of the names given after the NAMES "
  70. "argument. Paths specified after the PATHS argument are searched "
  71. "in the order specified. If the NO_SYSTEM_PATH argument is not "
  72. "specified, the search continues with the system search path "
  73. "specified by the PATH environment variable. A cache entry named "
  74. "by <VAR> is created to store the result. If the program is not "
  75. "found, the result will be <VAR>-NOTFOUND. If DOC is specified "
  76. "then the next argument is treated as a documentation string for "
  77. "the cache entry <VAR>.\n"
  78. " FIND_PROGRAM(VAR executableName [path1 path2 ...])\n"
  79. "Find a program with the given name by searching in the specified "
  80. "paths. This is a short-hand signature for the command that is "
  81. "sufficient in many cases.";
  82. }
  83. cmTypeMacro(cmFindProgramCommand, cmCommand);
  84. };
  85. #endif