cmAddExecutableCommand.h 5.1 KB

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