cmSetTargetPropertiesCommand.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. /**
  29. * The name of the command as specified in CMakeList.txt.
  30. */
  31. virtual const char* GetName() { return "SET_TARGET_PROPERTIES";}
  32. /**
  33. * Succinct documentation.
  34. */
  35. virtual const char* GetTerseDocumentation()
  36. {
  37. return "Targets can have properties that affect how they are built.";
  38. }
  39. /**
  40. * Longer documentation.
  41. */
  42. virtual const char* GetFullDocumentation()
  43. {
  44. return
  45. " SET_TARGET_PROPERTIES(target1 target2 ...\n"
  46. " PROPERTIES prop1 value1\n"
  47. " prop2 value2 ...)\n"
  48. "Set properties on a target. The syntax for the command is to "
  49. "list all the files you want "
  50. "to change, and then provide the values you want to set next. "
  51. "You can use any prop value pair you want and "
  52. "extract it later with the GET_TARGET_PROPERTY command.\n"
  53. "Properties that affect the name of a target's output file are "
  54. "as follows. "
  55. "The PREFIX and SUFFIX properties override the default target name "
  56. "prefix (such as \"lib\") and suffix (such as \".so\"). "
  57. "IMPORT_PREFIX and IMPORT_SUFFIX are the equivalent properties for "
  58. "the import library corresponding to a DLL "
  59. "(for SHARED library targets). "
  60. "OUTPUT_NAME sets the real name of a target when it is built and "
  61. "can be used to help create two targets of the same name even though "
  62. "CMake requires unique logical target names. "
  63. "<CONFIG>_POSTFIX sets a postfix for the real name of the target "
  64. "when it is built under the configuration named by <CONFIG> "
  65. "(in upper-case, such as \"DEBUG_POSTFIX\"). The value of "
  66. "this property is initialized when the target is created to the "
  67. "value of the variable CMAKE_<CONFIG>_POSTFIX (except for executable "
  68. "targets because earlier CMake versions which did not use this "
  69. "variable for executables)."
  70. "\n"
  71. "The LINK_FLAGS property can be used to add extra flags to the "
  72. "link step of a target. LINK_FLAGS_<CONFIG> will add to the configuration "
  73. "<CONFIG>, for example, DEBUG, RELEASE, MINSIZEREL, RELWITHDEBINFO. "
  74. "DEFINE_SYMBOL sets the name of the preprocessor symbol defined when "
  75. "compiling sources in a shared library. "
  76. "If not set here then it is set to target_EXPORTS by default "
  77. "(with some substitutions if the target is not a valid C "
  78. "identifier).\n"
  79. "For shared libraries VERSION and SOVERSION can be used to specify "
  80. "the build version and api version respectively. When building or "
  81. "installing appropriate symlinks are created if the platform "
  82. "supports symlinks and the linker supports so-names. "
  83. "If only one of both is specified the missing is assumed to have "
  84. "the same version number. "
  85. "For executables VERSION can be used to specify the build version. "
  86. "When building or installing appropriate symlinks are created if "
  87. "the platform supports symlinks.\n"
  88. "There are a few properties used to specify RPATH rules. "
  89. "INSTALL_RPATH is a semicolon-separated list specifying the rpath "
  90. "to use in installed targets (for platforms that support it). "
  91. "SKIP_BUILD_RPATH is a boolean specifying whether to skip automatic "
  92. "generation of an rpath allowing the target to run from the "
  93. "build tree. "
  94. "BUILD_WITH_INSTALL_RPATH is a boolean specifying whether to link "
  95. "the target in the build tree with the INSTALL_RPATH. This takes "
  96. "precedence over SKIP_BUILD_RPATH and avoids the need for relinking "
  97. "before installation. INSTALL_NAME_DIR is a string specifying the "
  98. "directory portion of the \"install_name\" field of shared libraries "
  99. "on Mac OSX to use in the installed targets. "
  100. "When the target is created the values of "
  101. "the variables CMAKE_INSTALL_RPATH, CMAKE_SKIP_BUILD_RPATH, "
  102. "CMAKE_BUILD_WITH_INSTALL_RPATH, and CMAKE_INSTALL_NAME_DIR "
  103. "are used to initialize these properties.\n"
  104. "PROJECT_LABEL can be used to change the name of "
  105. "the target in an IDE like visual studio. VS_KEYWORD can be set "
  106. "to change the visual studio keyword, for example QT integration "
  107. "works better if this is set to Qt4VSv1.0.\n"
  108. "The PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT properties are the "
  109. "old way to specify CMake scripts to run before and after "
  110. "installing a target. They are used only when the old "
  111. "INSTALL_TARGETS command is used to install the target. Use the "
  112. "INSTALL command instead."
  113. ;
  114. }
  115. cmTypeMacro(cmSetTargetPropertiesCommand, cmCommand);
  116. };
  117. #endif