cmTargetLinkLibrariesCommand.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 cmTargetLinkLibrariesCommand_h
  14. #define cmTargetLinkLibrariesCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmTargetLinkLibrariesCommand
  17. * \brief Specify a list of libraries to link into executables.
  18. *
  19. * cmTargetLinkLibrariesCommand is used to specify a list of libraries to link
  20. * into executable(s) or shared objects. The names of the libraries
  21. * should be those defined by the LIBRARY(library) command(s).
  22. */
  23. class cmTargetLinkLibrariesCommand : public cmCommand
  24. {
  25. public:
  26. /**
  27. * This is a virtual constructor for the command.
  28. */
  29. virtual cmCommand* Clone()
  30. {
  31. return new cmTargetLinkLibrariesCommand;
  32. }
  33. /**
  34. * This is called when the command is first encountered in
  35. * the CMakeLists.txt file.
  36. */
  37. virtual bool InitialPass(std::vector<std::string> const& args,
  38. cmExecutionStatus &status);
  39. /**
  40. * The name of the command as specified in CMakeList.txt.
  41. */
  42. virtual const char* GetName() { return "target_link_libraries";}
  43. /**
  44. * Succinct documentation.
  45. */
  46. virtual const char* GetTerseDocumentation()
  47. {
  48. return
  49. "Link a target to given libraries.";
  50. }
  51. /**
  52. * More documentation.
  53. */
  54. virtual const char* GetFullDocumentation()
  55. {
  56. return
  57. " target_link_libraries(target library1\n"
  58. " <debug | optimized | general> library2\n"
  59. " ...)\n"
  60. "Specify a list of libraries to be linked into the specified target. "
  61. "The debug and optimized strings may be used to indicate that "
  62. "the next library listed is to be used only for that specific "
  63. "type of build. general indicates it is used for all build types "
  64. "and is assumed if not specified.\n"
  65. "If any library name matches that of a target in the current project "
  66. "a dependency will automatically be added in the build system to make "
  67. "sure the library being linked is up-to-date before the target links.";
  68. }
  69. cmTypeMacro(cmTargetLinkLibrariesCommand, cmCommand);
  70. private:
  71. void LinkLibraryTypeSpecifierWarning(int left, int right);
  72. static const char* LinkLibraryTypeNames[3];
  73. };
  74. #endif