cmTargetLinkLibrariesCommand.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmTargetLinkLibrariesCommand_h
  4. #define cmTargetLinkLibrariesCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cmCommand.h"
  9. #include "cmTargetLinkLibraryType.h"
  10. class cmExecutionStatus;
  11. class cmTarget;
  12. /** \class cmTargetLinkLibrariesCommand
  13. * \brief Specify a list of libraries to link into executables.
  14. *
  15. * cmTargetLinkLibrariesCommand is used to specify a list of libraries to link
  16. * into executable(s) or shared objects. The names of the libraries
  17. * should be those defined by the LIBRARY(library) command(s).
  18. *
  19. * Additionally, it allows to propagate usage-requirements (including link
  20. * libraries) from one target into another.
  21. */
  22. class cmTargetLinkLibrariesCommand : public cmCommand
  23. {
  24. public:
  25. /**
  26. * This is a virtual constructor for the command.
  27. */
  28. cmCommand* Clone() override { return new cmTargetLinkLibrariesCommand; }
  29. /**
  30. * This is called when the command is first encountered in
  31. * the CMakeLists.txt file.
  32. */
  33. bool InitialPass(std::vector<std::string> const& args,
  34. cmExecutionStatus& status) override;
  35. private:
  36. void LinkLibraryTypeSpecifierWarning(int left, int right);
  37. static const char* LinkLibraryTypeNames[3];
  38. cmTarget* Target;
  39. enum ProcessingState
  40. {
  41. ProcessingLinkLibraries,
  42. ProcessingPlainLinkInterface,
  43. ProcessingKeywordLinkInterface,
  44. ProcessingPlainPublicInterface,
  45. ProcessingKeywordPublicInterface,
  46. ProcessingPlainPrivateInterface,
  47. ProcessingKeywordPrivateInterface
  48. };
  49. ProcessingState CurrentProcessingState;
  50. bool HandleLibrary(const std::string& lib, cmTargetLinkLibraryType llt);
  51. };
  52. #endif