cmExecProgramCommand.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 cmExecProgramCommand_h
  11. #define cmExecProgramCommand_h
  12. #include "cmCommand.h"
  13. /** \class cmExecProgramCommand
  14. * \brief Command that adds a target to the build system.
  15. *
  16. * cmExecProgramCommand adds an extra target to the build system.
  17. * This is useful when you would like to add special
  18. * targets like "install,", "clean," and so on.
  19. */
  20. class cmExecProgramCommand : public cmCommand
  21. {
  22. public:
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. virtual cmCommand* Clone()
  27. {
  28. return new cmExecProgramCommand;
  29. }
  30. /**
  31. * This is called when the command is first encountered in
  32. * the CMakeLists.txt file.
  33. */
  34. virtual bool InitialPass(std::vector<std::string> const& args,
  35. cmExecutionStatus &status);
  36. /**
  37. * The name of the command as specified in CMakeList.txt.
  38. */
  39. virtual const char* GetName() const
  40. {return "exec_program";}
  41. /**
  42. * This determines if the command is invoked when in script mode.
  43. */
  44. virtual bool IsScriptable() const { return true; }
  45. /**
  46. * Succinct documentation.
  47. */
  48. virtual const char* GetTerseDocumentation() const
  49. {
  50. return
  51. "Deprecated. Use the execute_process() command instead.";
  52. }
  53. /**
  54. * More documentation.
  55. */
  56. virtual const char* GetFullDocumentation() const
  57. {
  58. return
  59. "Run an executable program during the processing of the CMakeList.txt"
  60. " file.\n"
  61. " exec_program(Executable [directory in which to run]\n"
  62. " [ARGS <arguments to executable>]\n"
  63. " [OUTPUT_VARIABLE <var>]\n"
  64. " [RETURN_VALUE <var>])\n"
  65. "The executable is run in the optionally specified directory. The "
  66. "executable can include arguments if it is double quoted, but it is "
  67. "better to use the optional ARGS argument to specify arguments to the "
  68. "program. This is because cmake will then be able to escape spaces "
  69. "in the executable path. An optional argument OUTPUT_VARIABLE "
  70. "specifies a variable in which to store the output. "
  71. "To capture the return value of the execution, provide a RETURN_VALUE. "
  72. "If OUTPUT_VARIABLE is specified, then no output will go to the "
  73. "stdout/stderr of the console running cmake.\n"
  74. ;
  75. }
  76. /** This command is kept for compatibility with older CMake versions. */
  77. virtual bool IsDiscouraged() const
  78. {
  79. return true;
  80. }
  81. cmTypeMacro(cmExecProgramCommand, cmCommand);
  82. };
  83. #endif