cmSetTargetPropertiesCommand.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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 cmSetTargetsPropertiesCommand_h
  14. #define cmSetTargetsPropertiesCommand_h
  15. #include "cmCommand.h"
  16. class cmSetTargetPropertiesCommand : public cmCommand
  17. {
  18. public:
  19. virtual cmCommand* Clone()
  20. {
  21. return new cmSetTargetPropertiesCommand;
  22. }
  23. /**
  24. * This is called when the command is first encountered in
  25. * the input file.
  26. */
  27. virtual bool InitialPass(std::vector<std::string> const& args,
  28. cmExecutionStatus &status);
  29. /**
  30. * The name of the command as specified in CMakeList.txt.
  31. */
  32. virtual const char* GetName() { return "set_target_properties";}
  33. /**
  34. * Succinct documentation.
  35. */
  36. virtual const char* GetTerseDocumentation()
  37. {
  38. return "Targets can have properties that affect how they are built.";
  39. }
  40. /**
  41. * Used by this command and cmSetPropertiesCommand
  42. */
  43. static bool SetOneTarget(const char *tname,
  44. std::vector<std::string> &propertyPairs,
  45. cmMakefile *mf);
  46. /**
  47. * Longer documentation.
  48. */
  49. virtual const char* GetFullDocumentation()
  50. {
  51. return
  52. " set_target_properties(target1 target2 ...\n"
  53. " PROPERTIES prop1 value1\n"
  54. " prop2 value2 ...)\n"
  55. "Set properties on a target. The syntax for the command is to "
  56. "list all the files you want "
  57. "to change, and then provide the values you want to set next. "
  58. "You can use any prop value pair you want and "
  59. "extract it later with the GET_TARGET_PROPERTY command.\n"
  60. "Properties that affect the name of a target's output file are "
  61. "as follows. "
  62. "The PREFIX and SUFFIX properties override the default target name "
  63. "prefix (such as \"lib\") and suffix (such as \".so\"). "
  64. "IMPORT_PREFIX and IMPORT_SUFFIX are the equivalent properties for "
  65. "the import library corresponding to a DLL "
  66. "(for SHARED library targets). "
  67. "OUTPUT_NAME sets the real name of a target when it is built and "
  68. "can be used to help create two targets of the same name even though "
  69. "CMake requires unique logical target names. There is also a "
  70. "<CONFIG>_OUTPUT_NAME that can set the output name on a "
  71. "per-configuration basis. "
  72. "<CONFIG>_POSTFIX sets a postfix for the real name of the target "
  73. "when it is built under the configuration named by <CONFIG> "
  74. "(in upper-case, such as \"DEBUG_POSTFIX\"). The value of "
  75. "this property is initialized when the target is created to the "
  76. "value of the variable CMAKE_<CONFIG>_POSTFIX (except for executable "
  77. "targets because earlier CMake versions which did not use this "
  78. "variable for executables)."
  79. "\n"
  80. "The LINK_FLAGS property can be used to add extra flags to the "
  81. "link step of a target. LINK_FLAGS_<CONFIG> will add to the "
  82. "configuration <CONFIG>, "
  83. "for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO. "
  84. "DEFINE_SYMBOL sets the name of the preprocessor symbol defined when "
  85. "compiling sources in a shared library. "
  86. "If not set here then it is set to target_EXPORTS by default "
  87. "(with some substitutions if the target is not a valid C "
  88. "identifier). This is useful for headers to know whether they are "
  89. "being included from inside their library our outside to properly "
  90. "setup dllexport/dllimport decorations. "
  91. "The COMPILE_FLAGS property sets additional compiler flags used "
  92. "to build sources within the target. It may also be used to pass "
  93. "additional preprocessor definitions."
  94. "\n"
  95. "The LINKER_LANGUAGE property is used to change the tool "
  96. "used to link an executable or shared library. The default is "
  97. "set the language to match the files in the library. CXX and C "
  98. "are common values for this property."
  99. "\n"
  100. "For shared libraries VERSION and SOVERSION can be used to specify "
  101. "the build version and api version respectively. When building or "
  102. "installing appropriate symlinks are created if the platform "
  103. "supports symlinks and the linker supports so-names. "
  104. "If only one of both is specified the missing is assumed to have "
  105. "the same version number. "
  106. "For executables VERSION can be used to specify the build version. "
  107. "When building or installing appropriate symlinks are created if "
  108. "the platform supports symlinks. "
  109. "For shared libraries and executables on Windows the VERSION "
  110. "attribute is parsed to extract a \"major.minor\" version number. "
  111. "These numbers are used as the image version of the binary. "
  112. "\n"
  113. "There are a few properties used to specify RPATH rules. "
  114. "INSTALL_RPATH is a semicolon-separated list specifying the rpath "
  115. "to use in installed targets (for platforms that support it). "
  116. "INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to true will "
  117. "append directories in the linker search path and outside the "
  118. "project to the INSTALL_RPATH. "
  119. "SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic "
  120. "generation of an rpath allowing the target to run from the "
  121. "build tree. "
  122. "BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link "
  123. "the target in the build tree with the INSTALL_RPATH. This takes "
  124. "precedence over SKIP_BUILD_RPATH and avoids the need for relinking "
  125. "before installation. INSTALL_NAME_DIR is a string specifying the "
  126. "directory portion of the \"install_name\" field of shared libraries "
  127. "on Mac OSX to use in the installed targets. "
  128. "When the target is created the values of "
  129. "the variables CMAKE_INSTALL_RPATH, "
  130. "CMAKE_INSTALL_RPATH_USE_LINK_PATH, CMAKE_SKIP_BUILD_RPATH, "
  131. "CMAKE_BUILD_WITH_INSTALL_RPATH, and CMAKE_INSTALL_NAME_DIR "
  132. "are used to initialize these properties.\n"
  133. "PROJECT_LABEL can be used to change the name of "
  134. "the target in an IDE like visual studio. VS_KEYWORD can be set "
  135. "to change the visual studio keyword, for example QT integration "
  136. "works better if this is set to Qt4VSv1.0.\n"
  137. "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER can be set "
  138. "to add support for source control bindings in a Visual Studio "
  139. "project file.\n"
  140. "The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the "
  141. "old way to specify CMake scripts to run before and after "
  142. "installing a target. They are used only when the old "
  143. "INSTALL_TARGETS command is used to install the target. Use the "
  144. "INSTALL command instead."
  145. "\n"
  146. "The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual "
  147. "studio generators. If it is set to 1 the target will not be "
  148. "part of the default build when you select \"Build Solution\"."
  149. ;
  150. }
  151. cmTypeMacro(cmSetTargetPropertiesCommand, cmCommand);
  152. };
  153. #endif