cmSetTargetPropertiesCommand.h 7.9 KB

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