cmAddExecutableCommand.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 cmExecutablesCommand_h
  14. #define cmExecutablesCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmExecutablesCommand
  17. * \brief Defines a list of executables to build.
  18. *
  19. * cmExecutablesCommand defines a list of executable (i.e., test)
  20. * programs to create.
  21. */
  22. class cmAddExecutableCommand : public cmCommand
  23. {
  24. public:
  25. /**
  26. * This is a virtual constructor for the command.
  27. */
  28. virtual cmCommand* Clone()
  29. {
  30. return new cmAddExecutableCommand;
  31. }
  32. /**
  33. * This is called when the command is first encountered in
  34. * the CMakeLists.txt file.
  35. */
  36. virtual bool InitialPass(std::vector<std::string> const& args,
  37. cmExecutionStatus &status);
  38. /**
  39. * The name of the command as specified in CMakeList.txt.
  40. */
  41. virtual const char* GetName() { return "add_executable";}
  42. /**
  43. * Succinct documentation.
  44. */
  45. virtual const char* GetTerseDocumentation()
  46. {
  47. return
  48. "Add an executable to the project using the specified source files.";
  49. }
  50. /**
  51. * More documentation.
  52. */
  53. virtual const char* GetFullDocumentation()
  54. {
  55. return
  56. " add_executable(<name> [WIN32] [MACOSX_BUNDLE]\n"
  57. " [EXCLUDE_FROM_ALL]\n"
  58. " source1 source2 ... sourceN)\n"
  59. "Adds an executable target called <name> to be built from the "
  60. "source files listed in the command invocation. "
  61. "The <name> corresponds to the logical target name and must be "
  62. "globally unique within a project. "
  63. "The actual file name of the executable built is constructed based on "
  64. "conventions of the native platform "
  65. "(such as <name>.exe or just <name>). "
  66. "\n"
  67. "By default the executable file will be created in the build tree "
  68. "directory corresponding to the source tree directory in which "
  69. "the command was invoked. "
  70. "See documentation of the RUNTIME_OUTPUT_DIRECTORY "
  71. "target property to change this location. "
  72. "See documentation of the OUTPUT_NAME target property to change "
  73. "the <name> part of the final file name. "
  74. "\n"
  75. "If WIN32 is given the property WIN32_EXECUTABLE will be set on the "
  76. "target created. "
  77. "See documentation of that target property for details."
  78. "\n"
  79. "If MACOSX_BUNDLE is given the corresponding property will be "
  80. "set on the created target. "
  81. "See documentation of the MACOSX_BUNDLE target property for details."
  82. "\n"
  83. "If EXCLUDE_FROM_ALL is given the corresponding property will be "
  84. "set on the created target. "
  85. "See documentation of the EXCLUDE_FROM_ALL target property for "
  86. "details."
  87. "\n"
  88. "The add_executable command can also create IMPORTED executable "
  89. "targets using this signature:\n"
  90. " add_executable(<name> IMPORTED)\n"
  91. "An IMPORTED executable target references an executable file located "
  92. "outside the project. "
  93. "No rules are generated to build it. "
  94. "The target name has scope in the directory in which it is created "
  95. "and below. "
  96. "It may be referenced like any target built within the project. "
  97. "IMPORTED executables are useful for convenient reference from "
  98. "commands like add_custom_command. "
  99. "Details about the imported executable are specified by setting "
  100. "properties whose names begin in \"IMPORTED_\". "
  101. "The most important such property is IMPORTED_LOCATION "
  102. "(and its per-configuration version IMPORTED_LOCATION_<CONFIG>) "
  103. "which specifies the location of the main executable file on disk. "
  104. "See documentation of the IMPORTED_* properties for more information."
  105. ;
  106. }
  107. cmTypeMacro(cmAddExecutableCommand, cmCommand);
  108. };
  109. #endif