CMake/Source/cmTargetLinkLibrariesCommand.h
Marc Chevrier c688b401d3 cmstd: Modernize CMake system headers
Provide a standardized way to handle the C++ "standard" headers
customized to be used with current CMake C++ standard constraints.
Offer under directory `cm` headers which can be used as direct
replacements of the standard ones.  For example:

    #include <cm/string_view>

can be used safely for CMake development in place of the `<string_view>`
standard header.

Fixes: #19491
2019-09-20 10:01:37 -04:00

69 lines
1.9 KiB
C++

/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmTargetLinkLibrariesCommand_h
#define cmTargetLinkLibrariesCommand_h
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
#include <vector>
#include <cm/memory>
#include "cmCommand.h"
#include "cmTargetLinkLibraryType.h"
class cmExecutionStatus;
class cmTarget;
/** \class cmTargetLinkLibrariesCommand
* \brief Specify a list of libraries to link into executables.
*
* cmTargetLinkLibrariesCommand is used to specify a list of libraries to link
* into executable(s) or shared objects. The names of the libraries
* should be those defined by the LIBRARY(library) command(s).
*
* Additionally, it allows to propagate usage-requirements (including link
* libraries) from one target into another.
*/
class cmTargetLinkLibrariesCommand : public cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
std::unique_ptr<cmCommand> Clone() override
{
return cm::make_unique<cmTargetLinkLibrariesCommand>();
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus& status) override;
private:
void LinkLibraryTypeSpecifierWarning(int left, int right);
static const char* LinkLibraryTypeNames[3];
cmTarget* Target = nullptr;
enum ProcessingState
{
ProcessingLinkLibraries,
ProcessingPlainLinkInterface,
ProcessingKeywordLinkInterface,
ProcessingPlainPublicInterface,
ProcessingKeywordPublicInterface,
ProcessingPlainPrivateInterface,
ProcessingKeywordPrivateInterface
};
ProcessingState CurrentProcessingState = ProcessingLinkLibraries;
bool HandleLibrary(const std::string& lib, cmTargetLinkLibraryType llt);
};
#endif