2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2012-03-07 16:44:48 +00:00
|
|
|
#ifndef cmGeneratorTarget_h
|
|
|
|
#define cmGeneratorTarget_h
|
|
|
|
|
2017-08-25 18:39:02 +00:00
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
2016-09-01 18:59:28 +00:00
|
|
|
|
2019-09-06 20:58:06 +00:00
|
|
|
#include <cstddef>
|
2016-09-01 18:59:28 +00:00
|
|
|
#include <map>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
2019-07-23 14:01:13 +00:00
|
|
|
#include <unordered_map>
|
2016-09-01 18:59:28 +00:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
2012-03-07 16:44:48 +00:00
|
|
|
|
2019-09-30 14:46:28 +00:00
|
|
|
#include "cmLinkItem.h"
|
|
|
|
#include "cmListFileCache.h"
|
|
|
|
#include "cmPolicies.h"
|
|
|
|
#include "cmStateTypes.h"
|
|
|
|
|
2016-09-01 18:59:28 +00:00
|
|
|
class cmComputeLinkInformation;
|
2012-03-07 16:44:48 +00:00
|
|
|
class cmCustomCommand;
|
|
|
|
class cmGlobalGenerator;
|
|
|
|
class cmLocalGenerator;
|
|
|
|
class cmMakefile;
|
|
|
|
class cmSourceFile;
|
|
|
|
class cmTarget;
|
|
|
|
|
2019-07-21 11:57:08 +00:00
|
|
|
struct cmGeneratorExpressionContext;
|
|
|
|
struct cmGeneratorExpressionDAGChecker;
|
|
|
|
|
2012-03-07 16:44:48 +00:00
|
|
|
class cmGeneratorTarget
|
|
|
|
{
|
|
|
|
public:
|
2015-06-06 11:14:04 +00:00
|
|
|
cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg);
|
2015-08-04 17:19:42 +00:00
|
|
|
~cmGeneratorTarget();
|
2012-03-07 16:44:48 +00:00
|
|
|
|
2019-01-23 19:30:01 +00:00
|
|
|
cmGeneratorTarget(cmGeneratorTarget const&) = delete;
|
|
|
|
cmGeneratorTarget& operator=(cmGeneratorTarget const&) = delete;
|
|
|
|
|
2015-06-06 10:59:25 +00:00
|
|
|
cmLocalGenerator* GetLocalGenerator() const;
|
|
|
|
|
2016-10-12 22:18:25 +00:00
|
|
|
cmGlobalGenerator* GetGlobalGenerator() const;
|
|
|
|
|
2013-10-28 18:47:46 +00:00
|
|
|
bool IsImported() const;
|
2015-10-25 12:06:37 +00:00
|
|
|
bool IsImportedGloballyVisible() const;
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* GetLocation(const std::string& config) const;
|
2013-10-28 18:47:46 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
std::vector<cmCustomCommand> const& GetPreBuildCommands() const;
|
|
|
|
std::vector<cmCustomCommand> const& GetPreLinkCommands() const;
|
|
|
|
std::vector<cmCustomCommand> const& GetPostBuildCommands() const;
|
2015-10-22 22:42:58 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
#define DECLARE_TARGET_POLICY(POLICY) \
|
|
|
|
cmPolicies::PolicyStatus GetPolicyStatus##POLICY() const \
|
|
|
|
{ \
|
|
|
|
return this->PolicyMap.Get(cmPolicies::POLICY); \
|
|
|
|
}
|
2015-10-19 23:05:42 +00:00
|
|
|
|
|
|
|
CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
|
|
|
|
|
|
|
|
#undef DECLARE_TARGET_POLICY
|
|
|
|
|
2014-03-10 15:57:02 +00:00
|
|
|
/** Get the location of the target in the build tree with a placeholder
|
|
|
|
referencing the configuration in the native build system. This
|
|
|
|
location is suitable for use as the LOCATION target property. */
|
|
|
|
const char* GetLocationForBuild() const;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmComputeLinkInformation* GetLinkInformation(
|
|
|
|
const std::string& config) const;
|
2015-08-04 17:19:42 +00:00
|
|
|
|
2016-10-18 19:28:46 +00:00
|
|
|
cmStateEnums::TargetType GetType() const;
|
2016-01-15 13:06:45 +00:00
|
|
|
const std::string& GetName() const;
|
2015-10-17 13:08:13 +00:00
|
|
|
std::string GetExportName() const;
|
|
|
|
|
2015-10-25 09:35:36 +00:00
|
|
|
std::vector<std::string> GetPropertyKeys() const;
|
2019-03-31 09:27:12 +00:00
|
|
|
//! Might return a nullptr if the property is not set or invalid
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* GetProperty(const std::string& prop) const;
|
2019-03-31 09:27:12 +00:00
|
|
|
//! Always returns a valid pointer
|
2018-07-02 10:39:54 +00:00
|
|
|
const char* GetSafeProperty(const std::string& prop) const;
|
2013-09-02 20:27:32 +00:00
|
|
|
bool GetPropertyAsBool(const std::string& prop) const;
|
2014-02-13 16:25:00 +00:00
|
|
|
void GetSourceFiles(std::vector<cmSourceFile*>& files,
|
|
|
|
const std::string& config) const;
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<cmSourceFile*>> GetSourceFiles(
|
|
|
|
std::string const& config) const;
|
2012-09-17 10:02:24 +00:00
|
|
|
|
2017-04-07 19:05:08 +00:00
|
|
|
/** Source file kinds (classifications).
|
|
|
|
Generators use this to decide how to treat a source file. */
|
|
|
|
enum SourceKind
|
|
|
|
{
|
|
|
|
SourceKindAppManifest,
|
|
|
|
SourceKindCertificate,
|
|
|
|
SourceKindCustomCommand,
|
|
|
|
SourceKindExternalObject,
|
|
|
|
SourceKindExtra,
|
|
|
|
SourceKindHeader,
|
|
|
|
SourceKindIDL,
|
|
|
|
SourceKindManifest,
|
|
|
|
SourceKindModuleDefinition,
|
|
|
|
SourceKindObjectSource,
|
|
|
|
SourceKindResx,
|
|
|
|
SourceKindXaml
|
|
|
|
};
|
|
|
|
|
|
|
|
/** A source file paired with a kind (classification). */
|
|
|
|
struct SourceAndKind
|
|
|
|
{
|
2018-09-24 14:54:51 +00:00
|
|
|
BT<cmSourceFile*> Source;
|
2017-04-07 19:05:08 +00:00
|
|
|
SourceKind Kind;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** All sources needed for a configuration with kinds assigned. */
|
|
|
|
struct KindedSources
|
|
|
|
{
|
|
|
|
std::vector<SourceAndKind> Sources;
|
|
|
|
std::set<std::string> ExpectedResxHeaders;
|
|
|
|
std::set<std::string> ExpectedXamlHeaders;
|
|
|
|
std::set<std::string> ExpectedXamlSources;
|
2018-11-21 22:17:54 +00:00
|
|
|
bool Initialized = false;
|
2017-04-07 19:05:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Get all sources needed for a configuration with kinds assigned. */
|
|
|
|
KindedSources const& GetKindedSources(std::string const& config) const;
|
|
|
|
|
2017-04-10 20:41:03 +00:00
|
|
|
struct AllConfigSource
|
|
|
|
{
|
2019-10-02 17:48:37 +00:00
|
|
|
cmSourceFile* Source;
|
2017-04-10 20:41:03 +00:00
|
|
|
cmGeneratorTarget::SourceKind Kind;
|
|
|
|
std::vector<size_t> Configs;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Get all sources needed for all configurations with kinds and
|
|
|
|
per-source configurations assigned. */
|
|
|
|
std::vector<AllConfigSource> const& GetAllConfigSources() const;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void GetObjectSources(std::vector<cmSourceFile const*>&,
|
2014-02-13 16:25:00 +00:00
|
|
|
const std::string& config) const;
|
2013-11-10 10:22:44 +00:00
|
|
|
const std::string& GetObjectName(cmSourceFile const* file);
|
2017-03-23 13:31:45 +00:00
|
|
|
const char* GetCustomObjectExtension() const;
|
2013-11-10 10:22:44 +00:00
|
|
|
|
|
|
|
bool HasExplicitObjectName(cmSourceFile const* file) const;
|
2014-03-13 11:28:32 +00:00
|
|
|
void AddExplicitObjectName(cmSourceFile const* sf);
|
2013-11-10 10:22:44 +00:00
|
|
|
|
2017-03-08 20:54:40 +00:00
|
|
|
void GetModuleDefinitionSources(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
2014-02-13 16:25:00 +00:00
|
|
|
void GetResxSources(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
|
|
|
void GetExternalObjects(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
|
|
|
void GetHeaderSources(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
|
|
|
void GetExtraSources(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
|
|
|
void GetCustomCommands(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
|
|
|
void GetExpectedResxHeaders(std::set<std::string>&,
|
|
|
|
const std::string& config) const;
|
2014-08-11 18:08:49 +00:00
|
|
|
void GetAppManifest(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
2015-09-16 14:24:16 +00:00
|
|
|
void GetManifests(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
2014-08-11 18:17:12 +00:00
|
|
|
void GetCertificates(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
2015-03-31 20:49:39 +00:00
|
|
|
void GetXamlSources(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
|
|
|
void GetExpectedXamlHeaders(std::set<std::string>&,
|
|
|
|
const std::string& config) const;
|
|
|
|
void GetExpectedXamlSources(std::set<std::string>&,
|
|
|
|
const std::string& config) const;
|
2013-11-10 10:22:44 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
std::set<cmLinkItem> const& GetUtilityItems() const;
|
2015-10-07 23:01:38 +00:00
|
|
|
|
2014-03-14 12:21:26 +00:00
|
|
|
void ComputeObjectMapping();
|
|
|
|
|
2015-06-06 13:40:26 +00:00
|
|
|
const char* GetFeature(const std::string& feature,
|
|
|
|
const std::string& config) const;
|
2017-03-28 06:06:05 +00:00
|
|
|
|
2018-10-02 15:34:57 +00:00
|
|
|
const char* GetLinkPIEProperty(const std::string& config) const;
|
|
|
|
|
2017-06-14 14:12:48 +00:00
|
|
|
bool IsIPOEnabled(std::string const& lang, std::string const& config) const;
|
2015-06-06 13:40:26 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
bool IsLinkInterfaceDependentBoolProperty(const std::string& p,
|
|
|
|
const std::string& config) const;
|
|
|
|
bool IsLinkInterfaceDependentStringProperty(const std::string& p,
|
|
|
|
const std::string& config) const;
|
|
|
|
bool IsLinkInterfaceDependentNumberMinProperty(
|
|
|
|
const std::string& p, const std::string& config) const;
|
|
|
|
bool IsLinkInterfaceDependentNumberMaxProperty(
|
|
|
|
const std::string& p, const std::string& config) const;
|
2015-08-04 17:19:42 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
bool GetLinkInterfaceDependentBoolProperty(const std::string& p,
|
2015-08-04 17:19:43 +00:00
|
|
|
const std::string& config) const;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* GetLinkInterfaceDependentStringProperty(
|
|
|
|
const std::string& p, const std::string& config) const;
|
|
|
|
const char* GetLinkInterfaceDependentNumberMinProperty(
|
|
|
|
const std::string& p, const std::string& config) const;
|
|
|
|
const char* GetLinkInterfaceDependentNumberMaxProperty(
|
|
|
|
const std::string& p, const std::string& config) const;
|
2015-08-04 17:19:43 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmLinkInterface const* GetLinkInterface(
|
|
|
|
const std::string& config, const cmGeneratorTarget* headTarget) const;
|
2015-08-26 17:38:14 +00:00
|
|
|
void ComputeLinkInterface(const std::string& config,
|
|
|
|
cmOptionalLinkInterface& iface,
|
2015-09-16 02:55:52 +00:00
|
|
|
const cmGeneratorTarget* head) const;
|
2015-08-04 17:19:43 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmLinkInterfaceLibraries const* GetLinkInterfaceLibraries(
|
|
|
|
const std::string& config, const cmGeneratorTarget* headTarget,
|
|
|
|
bool usage_requirements_only) const;
|
2015-08-26 17:38:37 +00:00
|
|
|
|
2015-08-26 17:38:57 +00:00
|
|
|
void ComputeLinkInterfaceLibraries(const std::string& config,
|
2016-05-16 14:34:04 +00:00
|
|
|
cmOptionalLinkInterface& iface,
|
2015-09-16 02:50:32 +00:00
|
|
|
const cmGeneratorTarget* head,
|
2015-08-26 17:38:57 +00:00
|
|
|
bool usage_requirements_only) const;
|
|
|
|
|
2016-11-03 20:44:32 +00:00
|
|
|
/** Get the library name for an imported interface library. */
|
|
|
|
std::string GetImportedLibName(std::string const& config) const;
|
|
|
|
|
2012-10-06 16:30:43 +00:00
|
|
|
/** Get the full path to the target according to the settings in its
|
|
|
|
makefile and the configuration type. */
|
2017-04-19 17:10:09 +00:00
|
|
|
std::string GetFullPath(
|
|
|
|
const std::string& config = "",
|
|
|
|
cmStateEnums::ArtifactType artifact = cmStateEnums::RuntimeBinaryArtifact,
|
|
|
|
bool realname = false) const;
|
|
|
|
std::string NormalGetFullPath(const std::string& config,
|
|
|
|
cmStateEnums::ArtifactType artifact,
|
2012-10-06 16:30:43 +00:00
|
|
|
bool realname) const;
|
|
|
|
std::string NormalGetRealName(const std::string& config) const;
|
|
|
|
|
2017-04-11 18:42:39 +00:00
|
|
|
/** Get the names of an object library's object files underneath
|
|
|
|
its object file directory. */
|
|
|
|
void GetTargetObjectNames(std::string const& config,
|
|
|
|
std::vector<std::string>& objects) const;
|
|
|
|
|
2017-03-28 07:43:38 +00:00
|
|
|
/** What hierarchy level should the reported directory contain */
|
|
|
|
enum BundleDirectoryLevel
|
|
|
|
{
|
2017-03-27 18:54:22 +00:00
|
|
|
BundleDirLevel,
|
2017-03-28 07:43:38 +00:00
|
|
|
ContentLevel,
|
|
|
|
FullLevel
|
|
|
|
};
|
|
|
|
|
2015-08-04 17:19:48 +00:00
|
|
|
/** @return the Mac App directory without the base */
|
|
|
|
std::string GetAppBundleDirectory(const std::string& config,
|
2017-03-28 07:43:38 +00:00
|
|
|
BundleDirectoryLevel level) const;
|
2015-08-04 17:19:48 +00:00
|
|
|
|
2015-08-04 17:19:49 +00:00
|
|
|
/** Return whether this target is an executable Bundle, a framework
|
|
|
|
or CFBundle on Apple. */
|
|
|
|
bool IsBundleOnApple() const;
|
|
|
|
|
2015-08-04 17:19:48 +00:00
|
|
|
/** Get the full name of the target according to the settings in its
|
|
|
|
makefile. */
|
2016-05-16 14:34:04 +00:00
|
|
|
std::string GetFullName(const std::string& config = "",
|
2017-04-19 17:10:09 +00:00
|
|
|
cmStateEnums::ArtifactType artifact =
|
|
|
|
cmStateEnums::RuntimeBinaryArtifact) const;
|
2015-08-04 17:19:48 +00:00
|
|
|
|
2015-08-04 17:19:48 +00:00
|
|
|
/** @return the Mac framework directory without the base. */
|
|
|
|
std::string GetFrameworkDirectory(const std::string& config,
|
2017-03-28 07:43:38 +00:00
|
|
|
BundleDirectoryLevel level) const;
|
2015-08-04 17:19:48 +00:00
|
|
|
|
2015-10-22 22:47:31 +00:00
|
|
|
/** Return the framework version string. Undefined if
|
|
|
|
IsFrameworkOnApple returns false. */
|
|
|
|
std::string GetFrameworkVersion() const;
|
|
|
|
|
2015-08-04 17:19:48 +00:00
|
|
|
/** @return the Mac CFBundle directory without the base */
|
|
|
|
std::string GetCFBundleDirectory(const std::string& config,
|
2017-03-28 07:43:38 +00:00
|
|
|
BundleDirectoryLevel level) const;
|
2015-08-04 17:19:48 +00:00
|
|
|
|
2015-08-04 17:19:47 +00:00
|
|
|
/** Return the install name directory for the target in the
|
2018-06-01 13:53:41 +00:00
|
|
|
* build tree. For example: "\@rpath/", "\@loader_path/",
|
|
|
|
* or "/full/path/to/library". */
|
2015-08-04 17:19:47 +00:00
|
|
|
std::string GetInstallNameDirForBuildTree(const std::string& config) const;
|
|
|
|
|
|
|
|
/** Return the install name directory for the target in the
|
2018-06-01 13:53:41 +00:00
|
|
|
* install tree. For example: "\@rpath/" or "\@loader_path/". */
|
2015-08-04 17:19:47 +00:00
|
|
|
std::string GetInstallNameDirForInstallTree() const;
|
|
|
|
|
2015-10-19 20:39:08 +00:00
|
|
|
cmListFileBacktrace GetBacktrace() const;
|
|
|
|
|
2018-10-17 14:25:20 +00:00
|
|
|
std::set<BT<std::string>> const& GetUtilities() const;
|
2015-10-22 23:04:07 +00:00
|
|
|
|
2015-10-24 07:29:49 +00:00
|
|
|
bool LinkLanguagePropagatesToDependents() const
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
2016-10-18 19:28:46 +00:00
|
|
|
return this->GetType() == cmStateEnums::STATIC_LIBRARY;
|
2016-05-16 14:34:04 +00:00
|
|
|
}
|
2015-10-24 07:29:49 +00:00
|
|
|
|
2015-10-19 20:42:01 +00:00
|
|
|
/** Get the macro to define when building sources in this target.
|
|
|
|
If no macro should be defined null is returned. */
|
2018-10-14 23:00:34 +00:00
|
|
|
const std::string* GetExportMacro() const;
|
2015-10-19 20:42:01 +00:00
|
|
|
|
2015-08-04 17:19:41 +00:00
|
|
|
/** Get the soname of the target. Allowed only for a shared library. */
|
|
|
|
std::string GetSOName(const std::string& config) const;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void GetFullNameComponents(std::string& prefix, std::string& base,
|
|
|
|
std::string& suffix,
|
|
|
|
const std::string& config = "",
|
2017-04-19 17:10:09 +00:00
|
|
|
cmStateEnums::ArtifactType artifact =
|
|
|
|
cmStateEnums::RuntimeBinaryArtifact) const;
|
2015-08-04 17:19:47 +00:00
|
|
|
|
2017-03-28 07:43:38 +00:00
|
|
|
/** Append to @a base the bundle directory hierarchy up to a certain @a level
|
|
|
|
* and return it. */
|
|
|
|
std::string BuildBundleDirectory(const std::string& base,
|
|
|
|
const std::string& config,
|
|
|
|
BundleDirectoryLevel level) const;
|
2015-08-04 17:19:47 +00:00
|
|
|
|
|
|
|
/** @return the mac content directory for this target. */
|
2017-04-19 17:10:09 +00:00
|
|
|
std::string GetMacContentDirectory(
|
|
|
|
const std::string& config, cmStateEnums::ArtifactType artifact) const;
|
2015-08-04 17:19:47 +00:00
|
|
|
|
2016-08-30 18:55:37 +00:00
|
|
|
/** @return folder prefix for IDEs. */
|
|
|
|
std::string GetEffectiveFolderName() const;
|
|
|
|
|
2012-03-07 16:44:48 +00:00
|
|
|
cmTarget* Target;
|
|
|
|
cmMakefile* Makefile;
|
|
|
|
cmLocalGenerator* LocalGenerator;
|
2014-01-10 12:19:15 +00:00
|
|
|
cmGlobalGenerator const* GlobalGenerator;
|
2012-03-07 16:44:48 +00:00
|
|
|
|
2017-03-09 20:28:14 +00:00
|
|
|
struct ModuleDefinitionInfo
|
|
|
|
{
|
|
|
|
std::string DefFile;
|
2017-03-13 15:54:30 +00:00
|
|
|
bool DefFileGenerated;
|
2017-03-09 20:56:30 +00:00
|
|
|
bool WindowsExportAllSymbols;
|
2017-03-13 15:54:30 +00:00
|
|
|
std::vector<cmSourceFile const*> Sources;
|
2017-03-09 20:28:14 +00:00
|
|
|
};
|
|
|
|
ModuleDefinitionInfo const* GetModuleDefinitionInfo(
|
|
|
|
std::string const& config) const;
|
2012-03-07 16:44:48 +00:00
|
|
|
|
2015-10-19 22:44:15 +00:00
|
|
|
/** Return whether or not the target is for a DLL platform. */
|
|
|
|
bool IsDLLPlatform() const;
|
|
|
|
|
2015-10-19 22:42:01 +00:00
|
|
|
/** @return whether this target have a well defined output file name. */
|
|
|
|
bool HaveWellDefinedOutputFiles() const;
|
|
|
|
|
2015-08-04 17:19:49 +00:00
|
|
|
/** Link information from the transitive closure of the link
|
|
|
|
implementation and the interfaces of its dependencies. */
|
|
|
|
struct LinkClosure
|
|
|
|
{
|
|
|
|
// The preferred linker language.
|
|
|
|
std::string LinkerLanguage;
|
|
|
|
|
|
|
|
// Languages whose runtime libraries must be linked.
|
|
|
|
std::vector<std::string> Languages;
|
|
|
|
};
|
|
|
|
|
|
|
|
LinkClosure const* GetLinkClosure(const std::string& config) const;
|
|
|
|
void ComputeLinkClosure(const std::string& config, LinkClosure& lc) const;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmLinkImplementation const* GetLinkImplementation(
|
|
|
|
const std::string& config) const;
|
2015-08-05 15:37:49 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void ComputeLinkImplementationLanguages(
|
|
|
|
const std::string& config, cmOptionalLinkImplementation& impl) const;
|
2015-08-05 15:37:50 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmLinkImplementationLibraries const* GetLinkImplementationLibraries(
|
|
|
|
const std::string& config) const;
|
2015-08-05 16:17:55 +00:00
|
|
|
|
|
|
|
void ComputeLinkImplementationLibraries(const std::string& config,
|
|
|
|
cmOptionalLinkImplementation& impl,
|
2015-09-16 03:04:51 +00:00
|
|
|
const cmGeneratorTarget* head) const;
|
2015-08-05 16:17:55 +00:00
|
|
|
|
2018-09-10 14:11:57 +00:00
|
|
|
struct TargetOrString
|
|
|
|
{
|
|
|
|
std::string String;
|
|
|
|
cmGeneratorTarget* Target = nullptr;
|
|
|
|
};
|
|
|
|
TargetOrString ResolveTargetReference(std::string const& name) const;
|
|
|
|
|
2018-10-17 14:44:09 +00:00
|
|
|
cmLinkItem ResolveLinkItem(std::string const& name,
|
|
|
|
cmListFileBacktrace const& bt) const;
|
2015-10-10 10:23:19 +00:00
|
|
|
|
2015-08-05 15:37:50 +00:00
|
|
|
// Compute the set of languages compiled by the target. This is
|
|
|
|
// computed every time it is called because the languages can change
|
|
|
|
// when source file properties are changed and we do not have enough
|
|
|
|
// information to forward these property changes to the targets
|
|
|
|
// until we have per-target object file properties.
|
|
|
|
void GetLanguages(std::set<std::string>& languages,
|
|
|
|
std::string const& config) const;
|
|
|
|
|
2018-10-30 13:37:07 +00:00
|
|
|
bool IsCSharpOnly() const;
|
2018-03-19 20:08:38 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void GetObjectLibrariesCMP0026(
|
|
|
|
std::vector<cmGeneratorTarget*>& objlibs) const;
|
2015-10-16 17:19:48 +00:00
|
|
|
|
2015-10-16 17:19:50 +00:00
|
|
|
std::string GetFullNameImported(const std::string& config,
|
2017-04-19 17:10:09 +00:00
|
|
|
cmStateEnums::ArtifactType artifact) const;
|
2015-10-16 17:19:50 +00:00
|
|
|
|
2017-04-13 15:22:56 +00:00
|
|
|
/** Get source files common to all configurations and diagnose cases
|
|
|
|
with per-config sources. Excludes sources added by a TARGET_OBJECTS
|
|
|
|
generator expression. */
|
2015-08-05 15:37:50 +00:00
|
|
|
bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
|
|
|
|
|
2015-08-05 15:37:49 +00:00
|
|
|
bool HaveBuildTreeRPATH(const std::string& config) const;
|
|
|
|
|
2012-03-08 21:32:03 +00:00
|
|
|
/** Full path with trailing slash to the top-level directory
|
|
|
|
holding object files for this target. Includes the build
|
|
|
|
time config name placeholder if needed for the generator. */
|
|
|
|
std::string ObjectDirectory;
|
|
|
|
|
2017-04-11 18:12:52 +00:00
|
|
|
/** Full path with trailing slash to the top-level directory
|
|
|
|
holding object files for the given configuration. */
|
|
|
|
std::string GetObjectDirectory(std::string const& config) const;
|
|
|
|
|
2014-02-10 03:48:34 +00:00
|
|
|
void GetAppleArchs(const std::string& config,
|
2013-11-03 13:10:12 +00:00
|
|
|
std::vector<std::string>& archVec) const;
|
2012-09-15 23:19:54 +00:00
|
|
|
|
2017-03-28 06:47:42 +00:00
|
|
|
std::string GetFeatureSpecificLinkRuleVariable(
|
2017-06-14 14:12:48 +00:00
|
|
|
std::string const& var, std::string const& lang,
|
|
|
|
std::string const& config) const;
|
2017-03-28 06:47:42 +00:00
|
|
|
|
2014-05-21 13:38:24 +00:00
|
|
|
/** Return the rule variable used to create this type of target. */
|
|
|
|
std::string GetCreateRuleVariable(std::string const& lang,
|
|
|
|
std::string const& config) const;
|
2012-09-15 23:19:54 +00:00
|
|
|
|
2012-09-16 08:03:42 +00:00
|
|
|
/** Get the include directories for this target. */
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetIncludeDirectories(
|
2016-05-16 14:34:04 +00:00
|
|
|
const std::string& config, const std::string& lang) const;
|
2012-09-16 08:03:42 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void GetCompileOptions(std::vector<std::string>& result,
|
2015-08-04 21:43:56 +00:00
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetCompileOptions(
|
|
|
|
std::string const& config, std::string const& language) const;
|
2015-08-04 21:43:56 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void GetCompileFeatures(std::vector<std::string>& features,
|
2015-08-04 21:48:58 +00:00
|
|
|
const std::string& config) const;
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetCompileFeatures(
|
|
|
|
std::string const& config) const;
|
2015-08-04 21:48:58 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void GetCompileDefinitions(std::vector<std::string>& result,
|
2015-08-04 22:00:53 +00:00
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetCompileDefinitions(
|
|
|
|
std::string const& config, std::string const& language) const;
|
2015-08-04 22:00:53 +00:00
|
|
|
|
2018-04-24 15:01:01 +00:00
|
|
|
void GetLinkOptions(std::vector<std::string>& result,
|
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetLinkOptions(
|
|
|
|
std::string const& config, std::string const& language) const;
|
|
|
|
|
2018-08-15 13:20:18 +00:00
|
|
|
void GetStaticLibraryLinkOptions(std::vector<std::string>& result,
|
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetStaticLibraryLinkOptions(
|
|
|
|
std::string const& config, std::string const& language) const;
|
2018-04-24 15:01:01 +00:00
|
|
|
|
2018-09-14 15:48:20 +00:00
|
|
|
void GetLinkDirectories(std::vector<std::string>& result,
|
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetLinkDirectories(
|
|
|
|
std::string const& config, std::string const& language) const;
|
2018-09-14 15:48:20 +00:00
|
|
|
|
2018-06-26 14:21:05 +00:00
|
|
|
void GetLinkDepends(std::vector<std::string>& result,
|
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetLinkDepends(
|
|
|
|
std::string const& config, std::string const& language) const;
|
2018-06-26 14:21:05 +00:00
|
|
|
|
2015-03-12 21:44:38 +00:00
|
|
|
std::vector<BT<std::string>> GetPrecompileHeaders(
|
|
|
|
const std::string& config, const std::string& language) const;
|
|
|
|
|
2019-07-13 10:07:30 +00:00
|
|
|
std::string GetPchHeader(const std::string& config,
|
|
|
|
const std::string& language) const;
|
|
|
|
std::string GetPchSource(const std::string& config,
|
|
|
|
const std::string& language) const;
|
2019-08-30 14:21:19 +00:00
|
|
|
std::string GetPchFileObject(const std::string& config,
|
|
|
|
const std::string& language);
|
2019-10-05 10:20:37 +00:00
|
|
|
std::string GetPchFile(const std::string& config,
|
|
|
|
const std::string& language);
|
|
|
|
std::string GetPchCreateCompileOptions(const std::string& config,
|
|
|
|
const std::string& language);
|
|
|
|
std::string GetPchUseCompileOptions(const std::string& config,
|
|
|
|
const std::string& language);
|
2019-07-13 10:07:30 +00:00
|
|
|
|
2014-02-10 03:48:34 +00:00
|
|
|
bool IsSystemIncludeDirectory(const std::string& dir,
|
2018-03-12 15:37:11 +00:00
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
2013-07-01 20:28:26 +00:00
|
|
|
|
2012-09-14 17:04:25 +00:00
|
|
|
/** Add the target output files to the global generator manifest. */
|
2015-08-25 06:25:12 +00:00
|
|
|
void ComputeTargetManifest(const std::string& config) const;
|
2012-09-14 17:04:25 +00:00
|
|
|
|
2017-04-28 18:17:13 +00:00
|
|
|
bool ComputeCompileFeatures(std::string const& config) const;
|
|
|
|
|
2012-10-10 22:57:11 +00:00
|
|
|
/**
|
|
|
|
* Trace through the source files in this target and add al source files
|
|
|
|
* that they depend on, used by all generators
|
|
|
|
*/
|
|
|
|
void TraceDependencies();
|
|
|
|
|
2014-10-20 18:31:47 +00:00
|
|
|
/** Get the directory in which this target will be built. If the
|
|
|
|
configuration name is given then the generator will add its
|
|
|
|
subdirectory for that configuration. Otherwise just the canonical
|
|
|
|
output directory is given. */
|
|
|
|
std::string GetDirectory(const std::string& config = "",
|
2017-04-19 17:10:09 +00:00
|
|
|
cmStateEnums::ArtifactType artifact =
|
|
|
|
cmStateEnums::RuntimeBinaryArtifact) const;
|
2014-10-20 18:31:47 +00:00
|
|
|
|
2015-08-04 17:19:51 +00:00
|
|
|
/** Get the directory in which to place the target compiler .pdb file.
|
|
|
|
If the configuration name is given then the generator will add its
|
|
|
|
subdirectory for that configuration. Otherwise just the canonical
|
|
|
|
compiler pdb output directory is given. */
|
|
|
|
std::string GetCompilePDBDirectory(const std::string& config = "") const;
|
|
|
|
|
2012-10-10 22:57:11 +00:00
|
|
|
/** Get sources that must be built before the given source. */
|
2016-05-16 14:34:04 +00:00
|
|
|
std::vector<cmSourceFile*> const* GetSourceDepends(
|
|
|
|
cmSourceFile const* sf) const;
|
2012-10-10 22:57:11 +00:00
|
|
|
|
2015-08-05 16:47:35 +00:00
|
|
|
/** Return whether this target uses the default value for its output
|
|
|
|
directory. */
|
2017-04-19 17:10:09 +00:00
|
|
|
bool UsesDefaultOutputDir(const std::string& config,
|
|
|
|
cmStateEnums::ArtifactType artifact) const;
|
2015-08-05 16:47:35 +00:00
|
|
|
|
2015-08-05 16:55:14 +00:00
|
|
|
// Cache target output paths for each configuration.
|
|
|
|
struct OutputInfo
|
|
|
|
{
|
|
|
|
std::string OutDir;
|
|
|
|
std::string ImpDir;
|
|
|
|
std::string PdbDir;
|
|
|
|
bool empty() const
|
2016-05-16 14:34:04 +00:00
|
|
|
{
|
|
|
|
return OutDir.empty() && ImpDir.empty() && PdbDir.empty();
|
|
|
|
}
|
2015-08-05 16:55:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
OutputInfo const* GetOutputInfo(const std::string& config) const;
|
|
|
|
|
2019-04-03 15:27:39 +00:00
|
|
|
// Get the target PDB base name.
|
|
|
|
std::string GetPDBOutputName(const std::string& config) const;
|
|
|
|
|
2015-08-04 17:19:46 +00:00
|
|
|
/** Get the name of the pdb file for the target. */
|
2016-05-16 14:34:04 +00:00
|
|
|
std::string GetPDBName(const std::string& config = "") const;
|
2015-08-04 17:19:46 +00:00
|
|
|
|
2015-08-04 17:19:45 +00:00
|
|
|
/** Whether this library has soname enabled and platform supports it. */
|
|
|
|
bool HasSOName(const std::string& config) const;
|
|
|
|
|
2015-08-04 17:19:51 +00:00
|
|
|
struct CompileInfo
|
|
|
|
{
|
|
|
|
std::string CompilePdbDir;
|
|
|
|
};
|
|
|
|
|
|
|
|
CompileInfo const* GetCompileInfo(const std::string& config) const;
|
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using CompileInfoMapType = std::map<std::string, CompileInfo>;
|
2015-08-04 17:19:51 +00:00
|
|
|
mutable CompileInfoMapType CompileInfoMap;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
bool IsNullImpliedByLinkLibraries(const std::string& p) const;
|
2015-08-05 16:41:53 +00:00
|
|
|
|
2015-08-04 17:19:45 +00:00
|
|
|
/** Get the name of the compiler pdb file for the target. */
|
2016-05-16 14:34:04 +00:00
|
|
|
std::string GetCompilePDBName(const std::string& config = "") const;
|
2015-08-04 17:19:45 +00:00
|
|
|
|
|
|
|
/** Get the path for the MSVC /Fd option for this target. */
|
2016-05-16 14:34:04 +00:00
|
|
|
std::string GetCompilePDBPath(const std::string& config = "") const;
|
2015-08-04 17:19:45 +00:00
|
|
|
|
2015-08-04 17:19:50 +00:00
|
|
|
// Get the target base name.
|
2017-04-19 17:10:09 +00:00
|
|
|
std::string GetOutputName(const std::string& config,
|
|
|
|
cmStateEnums::ArtifactType artifact) const;
|
2015-08-04 17:19:50 +00:00
|
|
|
|
2019-04-10 15:52:11 +00:00
|
|
|
/** Get target file prefix */
|
|
|
|
std::string GetFilePrefix(const std::string& config,
|
|
|
|
cmStateEnums::ArtifactType artifact =
|
|
|
|
cmStateEnums::RuntimeBinaryArtifact) const;
|
|
|
|
/** Get target file prefix */
|
|
|
|
std::string GetFileSuffix(const std::string& config,
|
|
|
|
cmStateEnums::ArtifactType artifact =
|
|
|
|
cmStateEnums::RuntimeBinaryArtifact) const;
|
|
|
|
|
2019-04-19 11:30:03 +00:00
|
|
|
/** Get target file postfix */
|
|
|
|
std::string GetFilePostfix(const std::string& config) const;
|
|
|
|
|
2017-08-10 16:27:52 +00:00
|
|
|
/** Clears cached meta data for local and external source files.
|
2018-06-01 13:53:41 +00:00
|
|
|
* The meta data will be recomputed on demand.
|
|
|
|
*/
|
2017-08-10 16:27:52 +00:00
|
|
|
void ClearSourcesCache();
|
|
|
|
|
2019-01-17 10:14:38 +00:00
|
|
|
void AddSource(const std::string& src, bool before = false);
|
2015-08-29 16:10:19 +00:00
|
|
|
void AddTracedSources(std::vector<std::string> const& srcs);
|
|
|
|
|
2016-12-01 17:15:32 +00:00
|
|
|
/**
|
|
|
|
* Adds an entry to the INCLUDE_DIRECTORIES list.
|
|
|
|
* If before is true the entry is pushed at the front.
|
|
|
|
*/
|
|
|
|
void AddIncludeDirectory(const std::string& src, bool before = false);
|
|
|
|
|
2014-02-06 10:24:37 +00:00
|
|
|
/**
|
|
|
|
* Flags for a given source file as used in this target. Typically assigned
|
|
|
|
* via SET_TARGET_PROPERTIES when the property is a list of source files.
|
|
|
|
*/
|
|
|
|
enum SourceFileType
|
|
|
|
{
|
|
|
|
SourceFileTypeNormal,
|
|
|
|
SourceFileTypePrivateHeader, // is in "PRIVATE_HEADER" target property
|
|
|
|
SourceFileTypePublicHeader, // is in "PUBLIC_HEADER" target property
|
|
|
|
SourceFileTypeResource, // is in "RESOURCE" target property *or*
|
|
|
|
// has MACOSX_PACKAGE_LOCATION=="Resources"
|
2017-02-26 21:12:44 +00:00
|
|
|
SourceFileTypeDeepResource, // MACOSX_PACKAGE_LOCATION starts with
|
|
|
|
// "Resources/"
|
|
|
|
SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources[/]"
|
2014-02-06 10:24:37 +00:00
|
|
|
};
|
|
|
|
struct SourceFileFlags
|
|
|
|
{
|
2018-11-21 22:17:54 +00:00
|
|
|
SourceFileType Type = SourceFileTypeNormal;
|
|
|
|
const char* MacFolder = nullptr; // location inside Mac content folders
|
2014-02-06 10:24:37 +00:00
|
|
|
};
|
2016-05-16 14:34:04 +00:00
|
|
|
void GetAutoUicOptions(std::vector<std::string>& result,
|
2015-08-04 17:19:41 +00:00
|
|
|
const std::string& config) const;
|
|
|
|
|
2019-02-08 05:27:00 +00:00
|
|
|
struct Names
|
|
|
|
{
|
|
|
|
std::string Base;
|
|
|
|
std::string Output;
|
|
|
|
std::string Real;
|
|
|
|
std::string ImportLibrary;
|
|
|
|
std::string PDB;
|
|
|
|
std::string SharedObject;
|
|
|
|
};
|
|
|
|
|
2015-08-04 17:19:44 +00:00
|
|
|
/** Get the names of the executable needed to generate a build rule
|
|
|
|
that takes into account executable version numbers. This should
|
|
|
|
be called only on an executable target. */
|
2019-02-08 05:27:00 +00:00
|
|
|
Names GetExecutableNames(const std::string& config) const;
|
2014-02-06 10:24:37 +00:00
|
|
|
|
2015-08-04 17:19:45 +00:00
|
|
|
/** Get the names of the library needed to generate a build rule
|
|
|
|
that takes into account shared library version numbers. This
|
|
|
|
should be called only on a library target. */
|
2019-02-08 05:27:00 +00:00
|
|
|
Names GetLibraryNames(const std::string& config) const;
|
2015-08-04 17:19:45 +00:00
|
|
|
|
2015-08-04 17:19:46 +00:00
|
|
|
/**
|
|
|
|
* Compute whether this target must be relinked before installing.
|
|
|
|
*/
|
|
|
|
bool NeedRelinkBeforeInstall(const std::string& config) const;
|
|
|
|
|
2015-08-04 17:19:46 +00:00
|
|
|
/** Return true if builtin chrpath will work for this target */
|
|
|
|
bool IsChrpathUsed(const std::string& config) const;
|
|
|
|
|
2015-08-05 16:39:17 +00:00
|
|
|
/** Get the directory in which this targets .pdb files will be placed.
|
|
|
|
If the configuration name is given then the generator will add its
|
|
|
|
subdirectory for that configuration. Otherwise just the canonical
|
|
|
|
pdb output directory is given. */
|
|
|
|
std::string GetPDBDirectory(const std::string& config) const;
|
|
|
|
|
2019-03-31 09:27:12 +00:00
|
|
|
//! Return the preferred linker language for this target
|
2017-04-12 17:17:31 +00:00
|
|
|
std::string GetLinkerLanguage(const std::string& config) const;
|
2015-08-04 17:19:49 +00:00
|
|
|
|
2015-10-09 21:50:36 +00:00
|
|
|
/** Does this target have a GNU implib to convert to MS format? */
|
2018-04-04 06:03:29 +00:00
|
|
|
bool HasImplibGNUtoMS(std::string const& config) const;
|
2015-10-09 21:50:36 +00:00
|
|
|
|
|
|
|
/** Convert the given GNU import library name (.dll.a) to a name with a new
|
|
|
|
extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
|
2018-04-04 06:03:29 +00:00
|
|
|
bool GetImplibGNUtoMS(std::string const& config, std::string const& gnuName,
|
|
|
|
std::string& out, const char* newExt = nullptr) const;
|
2015-10-09 21:50:36 +00:00
|
|
|
|
2015-10-18 22:34:23 +00:00
|
|
|
bool IsExecutableWithExports() const;
|
|
|
|
|
2015-10-09 21:45:55 +00:00
|
|
|
/** Return whether or not the target has a DLL import library. */
|
2018-04-04 06:03:29 +00:00
|
|
|
bool HasImportLibrary(std::string const& config) const;
|
2015-10-09 21:45:55 +00:00
|
|
|
|
2015-10-09 22:29:47 +00:00
|
|
|
/** Get a build-tree directory in which to place target support files. */
|
|
|
|
std::string GetSupportDirectory() const;
|
|
|
|
|
2015-10-09 21:44:11 +00:00
|
|
|
/** Return whether this target may be used to link another target. */
|
|
|
|
bool IsLinkable() const;
|
|
|
|
|
2015-10-09 21:57:17 +00:00
|
|
|
/** Return whether this target is a shared library Framework on
|
|
|
|
Apple. */
|
|
|
|
bool IsFrameworkOnApple() const;
|
|
|
|
|
2015-10-09 21:58:19 +00:00
|
|
|
/** Return whether this target is an executable Bundle on Apple. */
|
|
|
|
bool IsAppBundleOnApple() const;
|
|
|
|
|
2015-10-09 22:15:38 +00:00
|
|
|
/** Return whether this target is a XCTest on Apple. */
|
|
|
|
bool IsXCTestOnApple() const;
|
|
|
|
|
2015-10-09 21:59:10 +00:00
|
|
|
/** Return whether this target is a CFBundle (plugin) on Apple. */
|
|
|
|
bool IsCFBundleOnApple() const;
|
|
|
|
|
2018-03-20 11:52:25 +00:00
|
|
|
/** Assembly types. The order of the values of this enum is relevant
|
|
|
|
because of smaller/larger comparison operations! */
|
|
|
|
enum ManagedType
|
|
|
|
{
|
|
|
|
Undefined = 0, // target is no lib or executable
|
|
|
|
Native, // target compiles to unmanaged binary.
|
|
|
|
Mixed, // target compiles to mixed (managed and unmanaged) binary.
|
|
|
|
Managed // target compiles to managed binary.
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Return the type of assembly this target compiles to. */
|
|
|
|
ManagedType GetManagedType(const std::string& config) const;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
struct SourceFileFlags GetTargetSourceFileFlags(
|
|
|
|
const cmSourceFile* sf) const;
|
2014-02-06 10:24:37 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void ReportPropertyOrigin(const std::string& p, const std::string& result,
|
|
|
|
const std::string& report,
|
|
|
|
const std::string& compatibilityType) const;
|
2015-08-04 17:19:44 +00:00
|
|
|
|
2015-08-04 21:14:53 +00:00
|
|
|
class TargetPropertyEntry;
|
|
|
|
|
2019-07-21 11:57:08 +00:00
|
|
|
std::string EvaluateInterfaceProperty(
|
|
|
|
std::string const& prop, cmGeneratorExpressionContext* context,
|
|
|
|
cmGeneratorExpressionDAGChecker* dagCheckerParent) const;
|
|
|
|
|
2019-06-24 22:30:38 +00:00
|
|
|
bool HaveInstallTreeRPATH(const std::string& config) const;
|
|
|
|
|
|
|
|
bool GetBuildRPATH(const std::string& config, std::string& rpath) const;
|
|
|
|
bool GetInstallRPATH(const std::string& config, std::string& rpath) const;
|
2015-08-05 17:02:45 +00:00
|
|
|
|
2015-08-05 17:07:03 +00:00
|
|
|
/** Whether this library has \@rpath and platform supports it. */
|
|
|
|
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
|
|
|
|
|
|
|
|
/** Whether this library defaults to \@rpath. */
|
|
|
|
bool MacOSXRpathInstallNameDirDefault() const;
|
|
|
|
|
2017-02-09 14:46:40 +00:00
|
|
|
enum InstallNameType
|
|
|
|
{
|
|
|
|
INSTALL_NAME_FOR_BUILD,
|
|
|
|
INSTALL_NAME_FOR_INSTALL
|
|
|
|
};
|
|
|
|
/** Whether to use INSTALL_NAME_DIR. */
|
|
|
|
bool MacOSXUseInstallNameDir() const;
|
|
|
|
/** Whether to generate an install_name. */
|
|
|
|
bool CanGenerateInstallNameDir(InstallNameType t) const;
|
|
|
|
|
2015-08-05 17:19:50 +00:00
|
|
|
/** Test for special case of a third-party shared library that has
|
|
|
|
no soname at all. */
|
|
|
|
bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
|
|
|
|
|
2018-07-11 14:58:48 +00:00
|
|
|
std::string ImportedGetLocation(const std::string& config) const;
|
2015-10-16 17:19:50 +00:00
|
|
|
|
2015-10-16 17:19:51 +00:00
|
|
|
/** Get the target major and minor version numbers interpreted from
|
|
|
|
the VERSION property. Version 0 is returned if the property is
|
|
|
|
not set or cannot be parsed. */
|
|
|
|
void GetTargetVersion(int& major, int& minor) const;
|
|
|
|
|
|
|
|
/** Get the target major, minor, and patch version numbers
|
|
|
|
interpreted from the VERSION or SOVERSION property. Version 0
|
|
|
|
is returned if the property is not set or cannot be parsed. */
|
2016-05-16 14:34:04 +00:00
|
|
|
void GetTargetVersion(bool soversion, int& major, int& minor,
|
|
|
|
int& patch) const;
|
2015-10-16 17:19:51 +00:00
|
|
|
|
2016-09-19 19:36:00 +00:00
|
|
|
std::string GetFortranModuleDirectory(std::string const& working_dir) const;
|
2016-06-10 14:58:36 +00:00
|
|
|
|
2016-10-12 22:18:26 +00:00
|
|
|
const char* GetSourcesProperty() const;
|
|
|
|
|
2013-11-10 10:22:44 +00:00
|
|
|
private:
|
2019-01-17 10:14:38 +00:00
|
|
|
void AddSourceCommon(const std::string& src, bool before = false);
|
2016-09-07 19:14:29 +00:00
|
|
|
|
2016-09-19 19:36:00 +00:00
|
|
|
std::string CreateFortranModuleDirectory(
|
|
|
|
std::string const& working_dir) const;
|
2016-06-10 14:58:36 +00:00
|
|
|
mutable bool FortranModuleDirectoryCreated;
|
|
|
|
mutable std::string FortranModuleDirectory;
|
|
|
|
|
2013-11-10 10:22:44 +00:00
|
|
|
friend class cmTargetTraceDependencies;
|
2016-05-16 14:34:04 +00:00
|
|
|
struct SourceEntry
|
|
|
|
{
|
|
|
|
std::vector<cmSourceFile*> Depends;
|
|
|
|
};
|
2019-09-04 16:03:01 +00:00
|
|
|
using SourceEntriesType = std::map<cmSourceFile const*, SourceEntry>;
|
2015-08-29 16:47:14 +00:00
|
|
|
SourceEntriesType SourceDepends;
|
2014-03-14 12:21:26 +00:00
|
|
|
mutable std::map<cmSourceFile const*, std::string> Objects;
|
2013-11-10 10:22:44 +00:00
|
|
|
std::set<cmSourceFile const*> ExplicitObjectName;
|
2017-08-25 21:25:09 +00:00
|
|
|
mutable std::map<std::string, std::vector<std::string>> SystemIncludesCache;
|
2013-07-02 12:30:10 +00:00
|
|
|
|
2015-10-19 20:42:01 +00:00
|
|
|
mutable std::string ExportMacro;
|
|
|
|
|
2014-02-06 10:24:37 +00:00
|
|
|
void ConstructSourceFileFlags() const;
|
|
|
|
mutable bool SourceFileFlagsConstructed;
|
|
|
|
mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
|
|
|
|
|
2015-08-04 17:19:44 +00:00
|
|
|
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
|
|
|
|
|
2019-07-12 15:22:36 +00:00
|
|
|
bool NeedImportLibraryName(std::string const& config) const;
|
|
|
|
|
|
|
|
const char* GetFilePrefixInternal(std::string const& config,
|
|
|
|
cmStateEnums::ArtifactType artifact,
|
2019-04-10 15:52:11 +00:00
|
|
|
const std::string& language = "") const;
|
2019-07-12 15:22:36 +00:00
|
|
|
const char* GetFileSuffixInternal(std::string const& config,
|
|
|
|
cmStateEnums::ArtifactType artifact,
|
2019-04-10 15:52:11 +00:00
|
|
|
const std::string& language = "") const;
|
|
|
|
|
2015-08-04 17:19:48 +00:00
|
|
|
std::string GetFullNameInternal(const std::string& config,
|
2017-04-19 17:10:09 +00:00
|
|
|
cmStateEnums::ArtifactType artifact) const;
|
|
|
|
void GetFullNameInternal(const std::string& config,
|
|
|
|
cmStateEnums::ArtifactType artifact,
|
2015-08-04 17:19:48 +00:00
|
|
|
std::string& outPrefix, std::string& outBase,
|
|
|
|
std::string& outSuffix) const;
|
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using LinkClosureMapType = std::map<std::string, LinkClosure>;
|
2015-08-04 17:19:49 +00:00
|
|
|
mutable LinkClosureMapType LinkClosureMap;
|
|
|
|
|
2015-08-05 17:11:48 +00:00
|
|
|
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
|
2017-04-19 17:10:09 +00:00
|
|
|
const char* GetOutputTargetType(cmStateEnums::ArtifactType artifact) const;
|
2015-08-05 17:11:48 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void ComputeVersionedName(std::string& vName, std::string const& prefix,
|
|
|
|
std::string const& base, std::string const& suffix,
|
2015-10-16 17:19:51 +00:00
|
|
|
std::string const& name,
|
|
|
|
const char* version) const;
|
|
|
|
|
2015-08-04 17:19:42 +00:00
|
|
|
struct CompatibleInterfacesBase
|
|
|
|
{
|
|
|
|
std::set<std::string> PropsBool;
|
|
|
|
std::set<std::string> PropsString;
|
|
|
|
std::set<std::string> PropsNumberMax;
|
|
|
|
std::set<std::string> PropsNumberMin;
|
|
|
|
};
|
2016-05-16 14:34:04 +00:00
|
|
|
CompatibleInterfacesBase const& GetCompatibleInterfaces(
|
|
|
|
std::string const& config) const;
|
2015-08-04 17:19:42 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
struct CompatibleInterfaces : public CompatibleInterfacesBase
|
2015-08-04 17:19:42 +00:00
|
|
|
{
|
2018-11-21 22:17:54 +00:00
|
|
|
bool Done = false;
|
2015-08-04 17:19:42 +00:00
|
|
|
};
|
|
|
|
mutable std::map<std::string, CompatibleInterfaces> CompatibleInterfacesMap;
|
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using cmTargetLinkInformationMap =
|
|
|
|
std::map<std::string, cmComputeLinkInformation*>;
|
2015-08-04 17:19:42 +00:00
|
|
|
mutable cmTargetLinkInformationMap LinkInformation;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
void CheckPropertyCompatibility(cmComputeLinkInformation* info,
|
2015-08-04 17:19:43 +00:00
|
|
|
const std::string& config) const;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
struct LinkImplClosure : public std::vector<cmGeneratorTarget const*>
|
2015-08-04 17:19:44 +00:00
|
|
|
{
|
2018-11-21 22:17:54 +00:00
|
|
|
bool Done = false;
|
2015-08-04 17:19:44 +00:00
|
|
|
};
|
|
|
|
mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap;
|
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using LinkInterfaceMapType = std::map<std::string, cmHeadToLinkInterfaceMap>;
|
2015-08-26 17:39:17 +00:00
|
|
|
mutable LinkInterfaceMapType LinkInterfaceMap;
|
|
|
|
mutable LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceMap(
|
|
|
|
std::string const& config) const;
|
2015-08-26 17:39:17 +00:00
|
|
|
cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceUsageRequirementsMap(
|
2016-05-16 14:34:04 +00:00
|
|
|
std::string const& config) const;
|
2015-08-26 17:39:17 +00:00
|
|
|
|
2018-10-02 15:34:57 +00:00
|
|
|
std::string GetLinkInterfaceDependentStringAsBoolProperty(
|
|
|
|
const std::string& p, const std::string& config) const;
|
|
|
|
|
2015-10-16 17:19:50 +00:00
|
|
|
// Cache import information from properties for each configuration.
|
|
|
|
struct ImportInfo
|
|
|
|
{
|
2018-11-21 22:17:54 +00:00
|
|
|
bool NoSOName = false;
|
|
|
|
ManagedType Managed = Native;
|
|
|
|
unsigned int Multiplicity = 0;
|
2015-10-16 17:19:50 +00:00
|
|
|
std::string Location;
|
|
|
|
std::string SOName;
|
|
|
|
std::string ImportLibrary;
|
2016-11-03 20:44:32 +00:00
|
|
|
std::string LibName;
|
2015-10-16 17:19:50 +00:00
|
|
|
std::string Languages;
|
|
|
|
std::string Libraries;
|
|
|
|
std::string LibrariesProp;
|
|
|
|
std::string SharedDeps;
|
|
|
|
};
|
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using ImportInfoMapType = std::map<std::string, ImportInfo>;
|
2015-10-16 17:19:50 +00:00
|
|
|
mutable ImportInfoMapType ImportInfoMap;
|
|
|
|
void ComputeImportInfo(std::string const& desired_config,
|
|
|
|
ImportInfo& info) const;
|
|
|
|
ImportInfo const* GetImportInfo(const std::string& config) const;
|
|
|
|
|
2015-10-16 17:19:51 +00:00
|
|
|
/** Strip off leading and trailing whitespace from an item named in
|
|
|
|
the link dependencies of this target. */
|
|
|
|
std::string CheckCMP0004(std::string const& item) const;
|
2015-10-16 17:19:50 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmLinkInterface const* GetImportLinkInterface(
|
|
|
|
const std::string& config, const cmGeneratorTarget* head,
|
|
|
|
bool usage_requirements_only) const;
|
2015-08-26 17:39:17 +00:00
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using KindedSourcesMapType = std::map<std::string, KindedSources>;
|
2017-04-07 19:05:08 +00:00
|
|
|
mutable KindedSourcesMapType KindedSourcesMap;
|
|
|
|
void ComputeKindedSources(KindedSources& files,
|
|
|
|
std::string const& config) const;
|
2015-09-13 08:18:15 +00:00
|
|
|
|
2017-04-10 20:41:03 +00:00
|
|
|
mutable std::vector<AllConfigSource> AllConfigSources;
|
|
|
|
void ComputeAllConfigSources() const;
|
|
|
|
|
2019-07-23 14:01:13 +00:00
|
|
|
mutable std::unordered_map<std::string, bool> MaybeInterfacePropertyExists;
|
|
|
|
bool MaybeHaveInterfaceProperty(std::string const& prop,
|
|
|
|
cmGeneratorExpressionContext* context) const;
|
|
|
|
|
2015-08-04 21:14:53 +00:00
|
|
|
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
|
2015-08-04 21:43:56 +00:00
|
|
|
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
|
2015-08-04 21:48:58 +00:00
|
|
|
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
|
2015-08-04 22:00:53 +00:00
|
|
|
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
|
2018-04-24 15:01:01 +00:00
|
|
|
std::vector<TargetPropertyEntry*> LinkOptionsEntries;
|
2018-09-14 15:48:20 +00:00
|
|
|
std::vector<TargetPropertyEntry*> LinkDirectoriesEntries;
|
2015-03-12 21:44:38 +00:00
|
|
|
std::vector<TargetPropertyEntry*> PrecompileHeadersEntries;
|
2015-09-13 08:18:15 +00:00
|
|
|
std::vector<TargetPropertyEntry*> SourceEntries;
|
2015-08-05 16:41:53 +00:00
|
|
|
mutable std::set<std::string> LinkImplicitNullProperties;
|
2015-03-12 21:44:38 +00:00
|
|
|
mutable std::map<std::string, std::string> PchHeaders;
|
|
|
|
mutable std::map<std::string, std::string> PchSources;
|
2019-08-30 14:21:19 +00:00
|
|
|
mutable std::map<std::string, std::string> PchObjectFiles;
|
2019-10-05 10:20:37 +00:00
|
|
|
mutable std::map<std::string, std::string> PchFiles;
|
|
|
|
mutable std::map<std::string, std::string> PchCreateCompileOptions;
|
|
|
|
mutable std::map<std::string, std::string> PchUseCompileOptions;
|
2015-08-04 21:14:53 +00:00
|
|
|
|
2015-08-04 17:22:30 +00:00
|
|
|
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
2015-09-16 03:07:31 +00:00
|
|
|
std::string const& config,
|
|
|
|
const cmGeneratorTarget* headTarget,
|
2015-08-04 17:22:30 +00:00
|
|
|
bool usage_requirements_only,
|
|
|
|
std::vector<cmLinkItem>& items,
|
|
|
|
bool& hadHeadSensitiveCondition) const;
|
|
|
|
void LookupLinkItems(std::vector<std::string> const& names,
|
2018-10-17 14:44:09 +00:00
|
|
|
cmListFileBacktrace const& bt,
|
2015-08-04 17:22:30 +00:00
|
|
|
std::vector<cmLinkItem>& items) const;
|
|
|
|
|
2018-09-24 14:54:51 +00:00
|
|
|
std::vector<BT<std::string>> GetSourceFilePaths(
|
|
|
|
std::string const& config) const;
|
|
|
|
std::vector<BT<cmSourceFile*>> GetSourceFilesWithoutObjectLibraries(
|
|
|
|
std::string const& config) const;
|
|
|
|
void GetSourceFilesWithoutObjectLibraries(std::vector<cmSourceFile*>& files,
|
|
|
|
const std::string& config) const;
|
2015-09-13 08:18:15 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
struct HeadToLinkImplementationMap
|
|
|
|
: public std::map<cmGeneratorTarget const*, cmOptionalLinkImplementation>
|
|
|
|
{
|
|
|
|
};
|
2019-09-04 16:03:01 +00:00
|
|
|
using LinkImplMapType = std::map<std::string, HeadToLinkImplementationMap>;
|
2015-08-05 16:17:55 +00:00
|
|
|
mutable LinkImplMapType LinkImplMap;
|
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
cmLinkImplementationLibraries const* GetLinkImplementationLibrariesInternal(
|
|
|
|
const std::string& config, const cmGeneratorTarget* head) const;
|
2017-04-19 17:10:09 +00:00
|
|
|
bool ComputeOutputDir(const std::string& config,
|
|
|
|
cmStateEnums::ArtifactType artifact,
|
2016-05-16 14:34:04 +00:00
|
|
|
std::string& out) const;
|
2015-08-05 16:55:14 +00:00
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using OutputInfoMapType = std::map<std::string, OutputInfo>;
|
2015-08-05 16:55:14 +00:00
|
|
|
mutable OutputInfoMapType OutputInfoMap;
|
2015-08-05 16:17:55 +00:00
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using ModuleDefinitionInfoMapType =
|
|
|
|
std::map<std::string, ModuleDefinitionInfo>;
|
2017-03-09 20:28:14 +00:00
|
|
|
mutable ModuleDefinitionInfoMapType ModuleDefinitionInfoMap;
|
|
|
|
void ComputeModuleDefinitionInfo(std::string const& config,
|
|
|
|
ModuleDefinitionInfo& info) const;
|
|
|
|
|
2019-09-04 16:03:01 +00:00
|
|
|
using OutputNameKey = std::pair<std::string, cmStateEnums::ArtifactType>;
|
|
|
|
using OutputNameMapType = std::map<OutputNameKey, std::string>;
|
2015-08-14 20:35:58 +00:00
|
|
|
mutable OutputNameMapType OutputNameMap;
|
2015-10-07 23:01:38 +00:00
|
|
|
mutable std::set<cmLinkItem> UtilityItems;
|
2015-10-19 23:05:42 +00:00
|
|
|
cmPolicies::PolicyMap PolicyMap;
|
2015-08-26 17:38:57 +00:00
|
|
|
mutable bool PolicyWarnedCMP0022;
|
2017-03-09 13:05:19 +00:00
|
|
|
mutable bool PolicyReportedCMP0069;
|
2015-08-04 21:14:53 +00:00
|
|
|
mutable bool DebugIncludesDone;
|
2015-08-04 21:43:56 +00:00
|
|
|
mutable bool DebugCompileOptionsDone;
|
2015-08-04 21:48:58 +00:00
|
|
|
mutable bool DebugCompileFeaturesDone;
|
2015-08-04 22:00:53 +00:00
|
|
|
mutable bool DebugCompileDefinitionsDone;
|
2018-04-24 15:01:01 +00:00
|
|
|
mutable bool DebugLinkOptionsDone;
|
2018-09-14 15:48:20 +00:00
|
|
|
mutable bool DebugLinkDirectoriesDone;
|
2015-03-12 21:44:38 +00:00
|
|
|
mutable bool DebugPrecompileHeadersDone;
|
2015-09-13 08:18:15 +00:00
|
|
|
mutable bool DebugSourcesDone;
|
|
|
|
mutable bool LinkImplementationLanguageIsContextDependent;
|
2015-10-07 23:01:38 +00:00
|
|
|
mutable bool UtilityItemsDone;
|
2015-08-14 20:35:58 +00:00
|
|
|
|
2015-08-05 17:01:23 +00:00
|
|
|
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
|
|
|
|
std::string& out) const;
|
|
|
|
|
2018-03-20 11:52:25 +00:00
|
|
|
ManagedType CheckManagedType(std::string const& propval) const;
|
|
|
|
|
2019-06-24 22:30:38 +00:00
|
|
|
bool GetRPATH(const std::string& config, const std::string& prop,
|
|
|
|
std::string& rpath) const;
|
|
|
|
|
2015-08-04 17:19:44 +00:00
|
|
|
public:
|
2016-05-16 14:34:04 +00:00
|
|
|
const std::vector<const cmGeneratorTarget*>& GetLinkImplementationClosure(
|
|
|
|
const std::string& config) const;
|
2015-08-04 17:19:44 +00:00
|
|
|
|
2015-08-05 16:17:55 +00:00
|
|
|
mutable std::map<std::string, std::string> MaxLanguageStandards;
|
2016-05-16 14:34:04 +00:00
|
|
|
std::map<std::string, std::string> const& GetMaxLanguageStandards() const
|
2015-08-05 16:17:55 +00:00
|
|
|
{
|
|
|
|
return this->MaxLanguageStandards;
|
|
|
|
}
|
2015-10-21 17:51:50 +00:00
|
|
|
|
2016-05-16 14:34:04 +00:00
|
|
|
struct StrictTargetComparison
|
|
|
|
{
|
2015-10-21 17:51:50 +00:00
|
|
|
bool operator()(cmGeneratorTarget const* t1,
|
|
|
|
cmGeneratorTarget const* t2) const;
|
|
|
|
};
|
2012-03-07 16:44:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|