cmFindProgramCommand.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 is invoked when in script mode.
  41. */
  42. virtual bool IsScriptable() { return true; }
  43. /**
  44. * The name of the command as specified in CMakeList.txt.
  45. */
  46. virtual const char* GetName() { return "FIND_PROGRAM";}
  47. /**
  48. * Succinct documentation.
  49. */
  50. virtual const char* GetTerseDocumentation()
  51. {
  52. return "Find an executable program.";
  53. }
  54. /**
  55. * More documentation.
  56. */
  57. virtual const char* GetFullDocumentation()
  58. {
  59. return
  60. " FIND_PROGRAM(<VAR> NAMES name1 [name2 ...]\n"
  61. " [PATHS path1 path2 ...]\n"
  62. " [NO_SYSTEM_PATH]\n"
  63. " [DOC \"docstring\"])\n"
  64. "Find an executable named by one of the names given after the NAMES "
  65. "argument. Paths specified after the PATHS argument are searched "
  66. "in the order specified. If the NO_SYSTEM_PATH argument is not "
  67. "specified, the search continues with the system search path "
  68. "specified by the PATH environment variable. A cache entry named "
  69. "by <VAR> is created to store the result. If the program is not "
  70. "found, the result will be <VAR>-NOTFOUND. If DOC is specified "
  71. "then the next argument is treated as a documentation string for "
  72. "the cache entry <VAR>.\n"
  73. " FIND_PROGRAM(VAR executableName [path1 path2 ...])\n"
  74. "Find a program with the given name by searching in the specified "
  75. "paths. This is a short-hand signature for the command that is "
  76. "sufficient in many cases.";
  77. }
  78. cmTypeMacro(cmFindProgramCommand, cmCommand);
  79. };
  80. #endif