2012-03-07 20:44:48 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
|
|
|
|
|
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
|
|
|
#ifndef cmGeneratorTarget_h
|
|
|
|
#define cmGeneratorTarget_h
|
|
|
|
|
2015-08-26 20:37:45 +03:00
|
|
|
#include "cmLinkItem.h"
|
2012-03-07 20:44:48 +04:00
|
|
|
|
|
|
|
class cmCustomCommand;
|
|
|
|
class cmGlobalGenerator;
|
|
|
|
class cmLocalGenerator;
|
|
|
|
class cmMakefile;
|
|
|
|
class cmSourceFile;
|
|
|
|
class cmTarget;
|
2015-08-04 20:19:42 +03:00
|
|
|
class cmComputeLinkInformation;
|
2012-03-07 20:44:48 +04:00
|
|
|
|
|
|
|
class cmGeneratorTarget
|
|
|
|
{
|
|
|
|
public:
|
2015-06-06 14:14:04 +03:00
|
|
|
cmGeneratorTarget(cmTarget*, cmLocalGenerator* lg);
|
2015-08-04 20:19:42 +03:00
|
|
|
~cmGeneratorTarget();
|
2012-03-07 20:44:48 +04:00
|
|
|
|
2015-06-06 13:59:25 +03:00
|
|
|
cmLocalGenerator* GetLocalGenerator() const;
|
|
|
|
|
2013-10-28 22:47:46 +04:00
|
|
|
bool IsImported() const;
|
2015-10-25 15:06:37 +03:00
|
|
|
bool IsImportedGloballyVisible() const;
|
2013-10-28 22:47:46 +04:00
|
|
|
const char *GetLocation(const std::string& config) const;
|
|
|
|
|
2015-10-23 01:42:58 +03:00
|
|
|
std::vector<cmCustomCommand> const &GetPreBuildCommands() const;
|
|
|
|
std::vector<cmCustomCommand> const &GetPreLinkCommands() const;
|
|
|
|
std::vector<cmCustomCommand> const &GetPostBuildCommands() const;
|
|
|
|
|
2015-10-20 02:05:42 +03:00
|
|
|
#define DECLARE_TARGET_POLICY(POLICY) \
|
|
|
|
cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
|
|
|
|
{ return this->PolicyMap.Get(cmPolicies::POLICY); }
|
|
|
|
|
|
|
|
CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
|
|
|
|
|
|
|
|
#undef DECLARE_TARGET_POLICY
|
|
|
|
|
2014-03-10 19:57:02 +04: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;
|
|
|
|
|
2015-08-04 20:19:42 +03:00
|
|
|
cmComputeLinkInformation*
|
|
|
|
GetLinkInformation(const std::string& config) const;
|
|
|
|
|
2015-10-08 01:23:34 +03:00
|
|
|
cmState::TargetType GetType() const;
|
2014-02-07 02:31:47 +04:00
|
|
|
std::string GetName() const;
|
2015-10-17 16:08:13 +03:00
|
|
|
std::string GetExportName() const;
|
|
|
|
|
2015-10-25 12:35:36 +03:00
|
|
|
std::vector<std::string> GetPropertyKeys() const;
|
2013-09-03 00:27:32 +04:00
|
|
|
const char *GetProperty(const std::string& prop) const;
|
|
|
|
bool GetPropertyAsBool(const std::string& prop) const;
|
2014-02-13 20:25:00 +04:00
|
|
|
void GetSourceFiles(std::vector<cmSourceFile*>& files,
|
|
|
|
const std::string& config) const;
|
2012-09-17 14:02:24 +04:00
|
|
|
|
2014-02-13 20:25:00 +04:00
|
|
|
void GetObjectSources(std::vector<cmSourceFile const*> &,
|
|
|
|
const std::string& config) const;
|
2013-11-10 14:22:44 +04:00
|
|
|
const std::string& GetObjectName(cmSourceFile const* file);
|
|
|
|
|
|
|
|
bool HasExplicitObjectName(cmSourceFile const* file) const;
|
2014-03-13 15:28:32 +04:00
|
|
|
void AddExplicitObjectName(cmSourceFile const* sf);
|
2013-11-10 14:22:44 +04:00
|
|
|
|
2014-02-13 20:25:00 +04:00
|
|
|
void GetResxSources(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
|
|
|
void GetIDLSources(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 22:08:49 +04:00
|
|
|
void GetAppManifest(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
2015-09-16 17:24:16 +03:00
|
|
|
void GetManifests(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
2014-08-11 22:17:12 +04:00
|
|
|
void GetCertificates(std::vector<cmSourceFile const*>&,
|
|
|
|
const std::string& config) const;
|
2015-03-31 23:49:39 +03: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 14:22:44 +04:00
|
|
|
|
2015-10-08 02:01:38 +03:00
|
|
|
std::set<cmLinkItem>const& GetUtilityItems() const;
|
|
|
|
|
2014-03-14 16:21:26 +04:00
|
|
|
void ComputeObjectMapping();
|
|
|
|
|
2015-06-06 16:40:26 +03:00
|
|
|
const char* GetFeature(const std::string& feature,
|
|
|
|
const std::string& config) const;
|
|
|
|
bool GetFeatureAsBool(const std::string& feature,
|
|
|
|
const std::string& config) const;
|
|
|
|
|
2015-08-04 20:19:42 +03: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 20:19:43 +03:00
|
|
|
bool GetLinkInterfaceDependentBoolProperty(const std::string &p,
|
|
|
|
const std::string& config) const;
|
|
|
|
|
|
|
|
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-26 20:37:45 +03:00
|
|
|
cmLinkInterface const* GetLinkInterface(const std::string& config,
|
2015-09-16 05:49:37 +03:00
|
|
|
const cmGeneratorTarget* headTarget) const;
|
2015-08-26 20:38:14 +03:00
|
|
|
void ComputeLinkInterface(const std::string& config,
|
|
|
|
cmOptionalLinkInterface& iface,
|
2015-09-16 05:55:52 +03:00
|
|
|
const cmGeneratorTarget* head) const;
|
2015-08-04 20:19:43 +03:00
|
|
|
|
2015-08-26 20:38:37 +03:00
|
|
|
cmLinkInterfaceLibraries const*
|
|
|
|
GetLinkInterfaceLibraries(const std::string& config,
|
2015-09-16 05:45:43 +03:00
|
|
|
const cmGeneratorTarget* headTarget,
|
2015-08-26 20:38:37 +03:00
|
|
|
bool usage_requirements_only) const;
|
|
|
|
|
2015-08-26 20:38:57 +03:00
|
|
|
void ComputeLinkInterfaceLibraries(const std::string& config,
|
|
|
|
cmOptionalLinkInterface &iface,
|
2015-09-16 05:50:32 +03:00
|
|
|
const cmGeneratorTarget* head,
|
2015-08-26 20:38:57 +03:00
|
|
|
bool usage_requirements_only) const;
|
|
|
|
|
2012-10-06 20:30:43 +04:00
|
|
|
/** Get the full path to the target according to the settings in its
|
|
|
|
makefile and the configuration type. */
|
|
|
|
std::string GetFullPath(const std::string& config="", bool implib = false,
|
|
|
|
bool realname = false) const;
|
|
|
|
std::string NormalGetFullPath(const std::string& config, bool implib,
|
|
|
|
bool realname) const;
|
|
|
|
std::string NormalGetRealName(const std::string& config) const;
|
|
|
|
|
2015-08-04 20:19:48 +03:00
|
|
|
/** @return the Mac App directory without the base */
|
|
|
|
std::string GetAppBundleDirectory(const std::string& config,
|
|
|
|
bool contentOnly) const;
|
|
|
|
|
2015-08-04 20:19:49 +03:00
|
|
|
/** Return whether this target is an executable Bundle, a framework
|
|
|
|
or CFBundle on Apple. */
|
|
|
|
bool IsBundleOnApple() const;
|
|
|
|
|
2015-08-04 20:19:48 +03:00
|
|
|
/** Get the full name of the target according to the settings in its
|
|
|
|
makefile. */
|
|
|
|
std::string GetFullName(const std::string& config="",
|
|
|
|
bool implib = false) const;
|
|
|
|
|
2015-08-04 20:19:48 +03:00
|
|
|
/** @return the Mac framework directory without the base. */
|
|
|
|
std::string GetFrameworkDirectory(const std::string& config,
|
|
|
|
bool rootDir) const;
|
|
|
|
|
2015-10-23 01:47:31 +03:00
|
|
|
/** Return the framework version string. Undefined if
|
|
|
|
IsFrameworkOnApple returns false. */
|
|
|
|
std::string GetFrameworkVersion() const;
|
|
|
|
|
2015-08-04 20:19:48 +03:00
|
|
|
/** @return the Mac CFBundle directory without the base */
|
|
|
|
std::string GetCFBundleDirectory(const std::string& config,
|
|
|
|
bool contentOnly) const;
|
|
|
|
|
2015-08-04 20:19:47 +03:00
|
|
|
/** Return the install name directory for the target in the
|
|
|
|
* build tree. For example: "\@rpath/", "\@loader_path/",
|
|
|
|
* or "/full/path/to/library". */
|
|
|
|
std::string GetInstallNameDirForBuildTree(const std::string& config) const;
|
|
|
|
|
|
|
|
/** Return the install name directory for the target in the
|
|
|
|
* install tree. For example: "\@rpath/" or "\@loader_path/". */
|
|
|
|
std::string GetInstallNameDirForInstallTree() const;
|
|
|
|
|
2015-10-19 23:39:08 +03:00
|
|
|
cmListFileBacktrace GetBacktrace() const;
|
|
|
|
|
2015-10-23 01:49:58 +03:00
|
|
|
const std::vector<std::string>& GetLinkDirectories() const;
|
|
|
|
|
2015-10-23 02:01:46 +03:00
|
|
|
std::set<std::string>const& GetUtilities() const;
|
2015-10-23 02:04:07 +03:00
|
|
|
cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
|
|
|
|
|
2015-10-24 10:29:49 +03:00
|
|
|
bool LinkLanguagePropagatesToDependents() const
|
|
|
|
{ return this->GetType() == cmState::STATIC_LIBRARY; }
|
|
|
|
|
2015-10-19 23:42:01 +03:00
|
|
|
/** Get the macro to define when building sources in this target.
|
|
|
|
If no macro should be defined null is returned. */
|
|
|
|
const char* GetExportMacro() const;
|
|
|
|
|
2015-08-04 20:19:41 +03:00
|
|
|
/** Get the soname of the target. Allowed only for a shared library. */
|
|
|
|
std::string GetSOName(const std::string& config) const;
|
|
|
|
|
2015-08-04 20:19:47 +03:00
|
|
|
void GetFullNameComponents(std::string& prefix,
|
|
|
|
std::string& base, std::string& suffix,
|
|
|
|
const std::string& config="",
|
|
|
|
bool implib = false) const;
|
|
|
|
|
2015-08-04 20:19:47 +03:00
|
|
|
/** Append to @a base the mac content directory and return it. */
|
|
|
|
std::string BuildMacContentDirectory(const std::string& base,
|
|
|
|
const std::string& config = "",
|
|
|
|
bool contentOnly = true) const;
|
|
|
|
|
|
|
|
/** @return the mac content directory for this target. */
|
|
|
|
std::string GetMacContentDirectory(const std::string& config = 0,
|
|
|
|
bool implib = false) const;
|
|
|
|
|
2012-03-07 20:44:48 +04:00
|
|
|
cmTarget* Target;
|
|
|
|
cmMakefile* Makefile;
|
|
|
|
cmLocalGenerator* LocalGenerator;
|
2014-01-10 16:19:15 +04:00
|
|
|
cmGlobalGenerator const* GlobalGenerator;
|
2012-03-07 20:44:48 +04:00
|
|
|
|
2015-11-02 17:24:25 +03:00
|
|
|
cmSourceFile const* GetModuleDefinitionFile(const std::string& config) const;
|
2012-03-07 20:44:48 +04:00
|
|
|
|
2015-10-20 01:44:15 +03:00
|
|
|
/** Return whether or not the target is for a DLL platform. */
|
|
|
|
bool IsDLLPlatform() const;
|
|
|
|
|
2015-10-20 01:42:01 +03:00
|
|
|
/** @return whether this target have a well defined output file name. */
|
|
|
|
bool HaveWellDefinedOutputFiles() const;
|
|
|
|
|
2015-08-04 20:19:49 +03: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;
|
|
|
|
|
2015-08-05 18:37:49 +03:00
|
|
|
cmLinkImplementation const*
|
|
|
|
GetLinkImplementation(const std::string& config) const;
|
|
|
|
|
2015-08-05 18:37:50 +03:00
|
|
|
void ComputeLinkImplementationLanguages(const std::string& config,
|
|
|
|
cmOptionalLinkImplementation& impl
|
|
|
|
) const;
|
|
|
|
|
2015-08-05 19:17:55 +03:00
|
|
|
cmLinkImplementationLibraries const*
|
|
|
|
GetLinkImplementationLibraries(const std::string& config) const;
|
|
|
|
|
|
|
|
void ComputeLinkImplementationLibraries(const std::string& config,
|
|
|
|
cmOptionalLinkImplementation& impl,
|
2015-09-16 06:04:51 +03:00
|
|
|
const cmGeneratorTarget* head) const;
|
2015-08-05 19:17:55 +03:00
|
|
|
|
2015-10-10 13:23:19 +03:00
|
|
|
cmGeneratorTarget* FindTargetToLink(std::string const& name) const;
|
|
|
|
|
2015-08-05 18:37:50 +03: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;
|
|
|
|
|
2015-10-16 20:19:48 +03:00
|
|
|
void
|
|
|
|
GetObjectLibrariesCMP0026(std::vector<cmGeneratorTarget*>& objlibs) const;
|
|
|
|
|
2015-10-16 20:19:50 +03:00
|
|
|
std::string GetFullNameImported(const std::string& config,
|
|
|
|
bool implib) const;
|
|
|
|
|
2015-08-05 18:37:50 +03:00
|
|
|
bool GetConfigCommonSourceFiles(std::vector<cmSourceFile*>& files) const;
|
|
|
|
|
2015-08-05 18:37:49 +03:00
|
|
|
bool HaveBuildTreeRPATH(const std::string& config) const;
|
|
|
|
|
2012-03-09 01:32:03 +04: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;
|
|
|
|
|
2014-02-13 20:25:00 +04:00
|
|
|
void UseObjectLibraries(std::vector<std::string>& objs,
|
|
|
|
const std::string& config) const;
|
2012-03-12 22:40:58 +04:00
|
|
|
|
2014-02-10 07:48:34 +04:00
|
|
|
void GetAppleArchs(const std::string& config,
|
2013-11-03 17:10:12 +04:00
|
|
|
std::vector<std::string>& archVec) const;
|
2012-09-16 03:19:54 +04:00
|
|
|
|
2014-05-21 17:38:24 +04: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-16 03:19:54 +04:00
|
|
|
|
2012-09-16 12:03:42 +04:00
|
|
|
/** Get the include directories for this target. */
|
2014-02-10 07:48:34 +04:00
|
|
|
std::vector<std::string> GetIncludeDirectories(
|
2015-03-04 23:53:15 +03:00
|
|
|
const std::string& config, const std::string& lang) const;
|
2012-09-16 12:03:42 +04:00
|
|
|
|
2015-08-05 00:43:56 +03:00
|
|
|
void GetCompileOptions(std::vector<std::string> &result,
|
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
|
|
|
|
2015-08-05 00:48:58 +03:00
|
|
|
void GetCompileFeatures(std::vector<std::string> &features,
|
|
|
|
const std::string& config) const;
|
|
|
|
|
2015-08-05 01:00:53 +03:00
|
|
|
void GetCompileDefinitions(std::vector<std::string> &result,
|
|
|
|
const std::string& config,
|
|
|
|
const std::string& language) const;
|
|
|
|
|
2014-02-10 07:48:34 +04:00
|
|
|
bool IsSystemIncludeDirectory(const std::string& dir,
|
|
|
|
const std::string& config) const;
|
2013-07-02 00:28:26 +04:00
|
|
|
|
2012-09-14 21:04:25 +04:00
|
|
|
/** Add the target output files to the global generator manifest. */
|
2015-08-25 09:25:12 +03:00
|
|
|
void ComputeTargetManifest(const std::string& config) const;
|
2012-09-14 21:04:25 +04:00
|
|
|
|
2012-10-11 02:57:11 +04: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 22:31:47 +04: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 = "",
|
|
|
|
bool implib = false) const;
|
|
|
|
|
2015-08-04 20:19:51 +03: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-11 02:57:11 +04:00
|
|
|
/** Get sources that must be built before the given source. */
|
2014-03-13 03:19:50 +04:00
|
|
|
std::vector<cmSourceFile*> const*
|
|
|
|
GetSourceDepends(cmSourceFile const* sf) const;
|
2012-10-11 02:57:11 +04:00
|
|
|
|
2015-08-05 19:47:35 +03:00
|
|
|
/** Return whether this target uses the default value for its output
|
|
|
|
directory. */
|
|
|
|
bool UsesDefaultOutputDir(const std::string& config, bool implib) const;
|
|
|
|
|
2015-08-05 19:55:14 +03:00
|
|
|
// Cache target output paths for each configuration.
|
|
|
|
struct OutputInfo
|
|
|
|
{
|
|
|
|
std::string OutDir;
|
|
|
|
std::string ImpDir;
|
|
|
|
std::string PdbDir;
|
|
|
|
bool empty() const
|
|
|
|
{ return OutDir.empty() && ImpDir.empty() && PdbDir.empty(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
OutputInfo const* GetOutputInfo(const std::string& config) const;
|
|
|
|
|
2015-08-04 20:19:46 +03:00
|
|
|
/** Get the name of the pdb file for the target. */
|
|
|
|
std::string GetPDBName(const std::string& config="") const;
|
|
|
|
|
2015-08-04 20:19:45 +03:00
|
|
|
/** Whether this library has soname enabled and platform supports it. */
|
|
|
|
bool HasSOName(const std::string& config) const;
|
|
|
|
|
2015-08-04 20:19:51 +03:00
|
|
|
struct CompileInfo
|
|
|
|
{
|
|
|
|
std::string CompilePdbDir;
|
|
|
|
};
|
|
|
|
|
|
|
|
CompileInfo const* GetCompileInfo(const std::string& config) const;
|
|
|
|
|
|
|
|
typedef std::map<std::string, CompileInfo> CompileInfoMapType;
|
|
|
|
mutable CompileInfoMapType CompileInfoMap;
|
|
|
|
|
2015-08-05 19:41:53 +03:00
|
|
|
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
|
|
|
|
|
2015-08-04 20:19:45 +03:00
|
|
|
/** Get the name of the compiler pdb file for the target. */
|
|
|
|
std::string GetCompilePDBName(const std::string& config="") const;
|
|
|
|
|
|
|
|
/** Get the path for the MSVC /Fd option for this target. */
|
|
|
|
std::string GetCompilePDBPath(const std::string& config="") const;
|
|
|
|
|
2015-08-04 20:19:50 +03:00
|
|
|
// Get the target base name.
|
|
|
|
std::string GetOutputName(const std::string& config, bool implib) const;
|
|
|
|
|
2015-08-29 19:10:19 +03:00
|
|
|
void AddSource(const std::string& src);
|
|
|
|
void AddTracedSources(std::vector<std::string> const& srcs);
|
|
|
|
|
2014-02-06 14:24:37 +04: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"
|
|
|
|
SourceFileTypeMacContent // has MACOSX_PACKAGE_LOCATION!="Resources"
|
|
|
|
};
|
|
|
|
struct SourceFileFlags
|
|
|
|
{
|
|
|
|
SourceFileFlags(): Type(SourceFileTypeNormal), MacFolder(0) {}
|
|
|
|
SourceFileFlags(SourceFileFlags const& r):
|
|
|
|
Type(r.Type), MacFolder(r.MacFolder) {}
|
|
|
|
SourceFileType Type;
|
|
|
|
const char* MacFolder; // location inside Mac content folders
|
|
|
|
};
|
2015-08-04 20:19:41 +03:00
|
|
|
void GetAutoUicOptions(std::vector<std::string> &result,
|
|
|
|
const std::string& config) const;
|
|
|
|
|
2015-08-04 20:19:44 +03: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. */
|
|
|
|
void GetExecutableNames(std::string& name, std::string& realName,
|
|
|
|
std::string& impName, std::string& pdbName,
|
|
|
|
const std::string& config) const;
|
2014-02-06 14:24:37 +04:00
|
|
|
|
2015-08-04 20:19:45 +03: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. */
|
|
|
|
void GetLibraryNames(std::string& name, std::string& soName,
|
|
|
|
std::string& realName, std::string& impName,
|
|
|
|
std::string& pdbName, const std::string& config) const;
|
|
|
|
|
2015-08-04 20:19:46 +03:00
|
|
|
/**
|
|
|
|
* Compute whether this target must be relinked before installing.
|
|
|
|
*/
|
|
|
|
bool NeedRelinkBeforeInstall(const std::string& config) const;
|
|
|
|
|
2015-08-04 20:19:46 +03:00
|
|
|
/** Return true if builtin chrpath will work for this target */
|
|
|
|
bool IsChrpathUsed(const std::string& config) const;
|
|
|
|
|
2015-08-05 19:39:17 +03: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;
|
|
|
|
|
2015-08-04 20:19:49 +03:00
|
|
|
///! Return the preferred linker language for this target
|
|
|
|
std::string GetLinkerLanguage(const std::string& config = "") const;
|
|
|
|
|
2015-10-10 00:50:36 +03:00
|
|
|
/** Does this target have a GNU implib to convert to MS format? */
|
|
|
|
bool HasImplibGNUtoMS() const;
|
|
|
|
|
|
|
|
/** Convert the given GNU import library name (.dll.a) to a name with a new
|
|
|
|
extension (.lib or ${CMAKE_IMPORT_LIBRARY_SUFFIX}). */
|
|
|
|
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
|
|
|
|
const char* newExt = 0) const;
|
|
|
|
|
2015-10-19 01:34:23 +03:00
|
|
|
bool IsExecutableWithExports() const;
|
|
|
|
|
2015-10-10 00:45:55 +03:00
|
|
|
/** Return whether or not the target has a DLL import library. */
|
|
|
|
bool HasImportLibrary() const;
|
|
|
|
|
2015-10-10 01:29:47 +03:00
|
|
|
/** Get a build-tree directory in which to place target support files. */
|
|
|
|
std::string GetSupportDirectory() const;
|
|
|
|
|
2015-10-10 00:44:11 +03:00
|
|
|
/** Return whether this target may be used to link another target. */
|
|
|
|
bool IsLinkable() const;
|
|
|
|
|
2015-10-10 00:57:17 +03:00
|
|
|
/** Return whether this target is a shared library Framework on
|
|
|
|
Apple. */
|
|
|
|
bool IsFrameworkOnApple() const;
|
|
|
|
|
2015-10-10 00:58:19 +03:00
|
|
|
/** Return whether this target is an executable Bundle on Apple. */
|
|
|
|
bool IsAppBundleOnApple() const;
|
|
|
|
|
2015-10-10 01:15:38 +03:00
|
|
|
/** Return whether this target is a XCTest on Apple. */
|
|
|
|
bool IsXCTestOnApple() const;
|
|
|
|
|
2015-10-10 00:59:10 +03:00
|
|
|
/** Return whether this target is a CFBundle (plugin) on Apple. */
|
|
|
|
bool IsCFBundleOnApple() const;
|
|
|
|
|
2014-02-06 14:24:37 +04:00
|
|
|
struct SourceFileFlags
|
|
|
|
GetTargetSourceFileFlags(const cmSourceFile* sf) const;
|
|
|
|
|
2014-02-14 00:07:31 +04:00
|
|
|
struct ResxData {
|
|
|
|
mutable std::set<std::string> ExpectedResxHeaders;
|
2014-03-13 02:06:05 +04:00
|
|
|
mutable std::vector<cmSourceFile const*> ResxSources;
|
2014-02-14 00:07:31 +04:00
|
|
|
};
|
2015-03-31 23:49:39 +03:00
|
|
|
|
|
|
|
struct XamlData {
|
|
|
|
std::set<std::string> ExpectedXamlHeaders;
|
|
|
|
std::set<std::string> ExpectedXamlSources;
|
|
|
|
std::vector<cmSourceFile const*> XamlSources;
|
|
|
|
};
|
|
|
|
|
2015-08-04 20:19:44 +03:00
|
|
|
void ReportPropertyOrigin(const std::string &p,
|
|
|
|
const std::string &result,
|
|
|
|
const std::string &report,
|
|
|
|
const std::string &compatibilityType) const;
|
|
|
|
|
2015-08-05 00:14:53 +03:00
|
|
|
class TargetPropertyEntry;
|
|
|
|
|
2015-08-05 20:02:45 +03:00
|
|
|
bool HaveInstallTreeRPATH() const;
|
|
|
|
|
2015-08-05 20:07:03 +03: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;
|
|
|
|
|
2015-08-05 20:19:50 +03:00
|
|
|
/** Test for special case of a third-party shared library that has
|
|
|
|
no soname at all. */
|
|
|
|
bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
|
|
|
|
|
2015-10-16 20:19:50 +03:00
|
|
|
const char* ImportedGetLocation(const std::string& config) const;
|
|
|
|
|
2015-10-16 20:19:51 +03: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. */
|
|
|
|
void
|
|
|
|
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
|
|
|
|
|
2013-11-10 14:22:44 +04:00
|
|
|
private:
|
|
|
|
friend class cmTargetTraceDependencies;
|
2012-10-11 02:57:11 +04:00
|
|
|
struct SourceEntry { std::vector<cmSourceFile*> Depends; };
|
2014-03-13 03:19:50 +04:00
|
|
|
typedef std::map<cmSourceFile const*, SourceEntry> SourceEntriesType;
|
2015-08-29 19:47:14 +03:00
|
|
|
SourceEntriesType SourceDepends;
|
2014-03-14 16:21:26 +04:00
|
|
|
mutable std::map<cmSourceFile const*, std::string> Objects;
|
2013-11-10 14:22:44 +04:00
|
|
|
std::set<cmSourceFile const*> ExplicitObjectName;
|
2013-11-03 17:10:12 +04:00
|
|
|
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
|
2013-07-02 16:30:10 +04:00
|
|
|
|
2015-10-19 23:42:01 +03:00
|
|
|
mutable std::string ExportMacro;
|
|
|
|
|
2014-02-06 14:24:37 +04:00
|
|
|
void ConstructSourceFileFlags() const;
|
|
|
|
mutable bool SourceFileFlagsConstructed;
|
|
|
|
mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
|
|
|
|
|
2015-08-04 20:19:44 +03:00
|
|
|
mutable std::map<std::string, bool> DebugCompatiblePropertiesDone;
|
|
|
|
|
2015-08-04 20:19:48 +03:00
|
|
|
std::string GetFullNameInternal(const std::string& config,
|
|
|
|
bool implib) const;
|
|
|
|
void GetFullNameInternal(const std::string& config, bool implib,
|
|
|
|
std::string& outPrefix, std::string& outBase,
|
|
|
|
std::string& outSuffix) const;
|
|
|
|
|
2015-08-04 20:19:49 +03:00
|
|
|
typedef std::map<std::string, LinkClosure> LinkClosureMapType;
|
|
|
|
mutable LinkClosureMapType LinkClosureMap;
|
|
|
|
|
2015-08-05 20:11:48 +03:00
|
|
|
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
|
|
|
|
const char* GetOutputTargetType(bool implib) const;
|
|
|
|
|
2015-10-16 20:19:51 +03:00
|
|
|
void ComputeVersionedName(std::string& vName,
|
|
|
|
std::string const& prefix,
|
|
|
|
std::string const& base,
|
|
|
|
std::string const& suffix,
|
|
|
|
std::string const& name,
|
|
|
|
const char* version) const;
|
|
|
|
|
2015-08-04 20:19:42 +03:00
|
|
|
struct CompatibleInterfacesBase
|
|
|
|
{
|
|
|
|
std::set<std::string> PropsBool;
|
|
|
|
std::set<std::string> PropsString;
|
|
|
|
std::set<std::string> PropsNumberMax;
|
|
|
|
std::set<std::string> PropsNumberMin;
|
|
|
|
};
|
|
|
|
CompatibleInterfacesBase const&
|
|
|
|
GetCompatibleInterfaces(std::string const& config) const;
|
|
|
|
|
|
|
|
struct CompatibleInterfaces: public CompatibleInterfacesBase
|
|
|
|
{
|
|
|
|
CompatibleInterfaces(): Done(false) {}
|
|
|
|
bool Done;
|
|
|
|
};
|
|
|
|
mutable std::map<std::string, CompatibleInterfaces> CompatibleInterfacesMap;
|
|
|
|
|
2015-08-04 20:19:42 +03:00
|
|
|
typedef std::map<std::string, cmComputeLinkInformation*>
|
|
|
|
cmTargetLinkInformationMap;
|
|
|
|
mutable cmTargetLinkInformationMap LinkInformation;
|
|
|
|
|
2015-08-04 20:19:43 +03:00
|
|
|
void CheckPropertyCompatibility(cmComputeLinkInformation *info,
|
|
|
|
const std::string& config) const;
|
|
|
|
|
2012-03-07 20:44:48 +04:00
|
|
|
cmGeneratorTarget(cmGeneratorTarget const&);
|
|
|
|
void operator=(cmGeneratorTarget const&);
|
2015-08-04 20:19:44 +03:00
|
|
|
|
2015-10-08 02:45:44 +03:00
|
|
|
struct LinkImplClosure: public std::vector<cmGeneratorTarget const*>
|
2015-08-04 20:19:44 +03:00
|
|
|
{
|
|
|
|
LinkImplClosure(): Done(false) {}
|
|
|
|
bool Done;
|
|
|
|
};
|
|
|
|
mutable std::map<std::string, LinkImplClosure> LinkImplClosureMap;
|
|
|
|
|
2015-08-26 20:39:17 +03:00
|
|
|
typedef std::map<std::string, cmHeadToLinkInterfaceMap>
|
|
|
|
LinkInterfaceMapType;
|
|
|
|
mutable LinkInterfaceMapType LinkInterfaceMap;
|
|
|
|
mutable LinkInterfaceMapType LinkInterfaceUsageRequirementsOnlyMap;
|
|
|
|
|
|
|
|
cmHeadToLinkInterfaceMap&
|
|
|
|
GetHeadToLinkInterfaceMap(std::string const& config) const;
|
|
|
|
cmHeadToLinkInterfaceMap& GetHeadToLinkInterfaceUsageRequirementsMap(
|
|
|
|
std::string const& config) const;
|
|
|
|
|
2015-10-16 20:19:50 +03:00
|
|
|
// Cache import information from properties for each configuration.
|
|
|
|
struct ImportInfo
|
|
|
|
{
|
|
|
|
ImportInfo(): NoSOName(false), Multiplicity(0) {}
|
|
|
|
bool NoSOName;
|
|
|
|
int Multiplicity;
|
|
|
|
std::string Location;
|
|
|
|
std::string SOName;
|
|
|
|
std::string ImportLibrary;
|
|
|
|
std::string Languages;
|
|
|
|
std::string Libraries;
|
|
|
|
std::string LibrariesProp;
|
|
|
|
std::string SharedDeps;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::map<std::string, ImportInfo> ImportInfoMapType;
|
|
|
|
mutable ImportInfoMapType ImportInfoMap;
|
|
|
|
void ComputeImportInfo(std::string const& desired_config,
|
|
|
|
ImportInfo& info) const;
|
|
|
|
ImportInfo const* GetImportInfo(const std::string& config) const;
|
|
|
|
|
2015-10-16 20:19:51 +03: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 20:19:50 +03:00
|
|
|
|
2015-08-26 20:39:17 +03:00
|
|
|
cmLinkInterface const*
|
2015-09-16 06:07:06 +03:00
|
|
|
GetImportLinkInterface(const std::string& config,
|
|
|
|
const cmGeneratorTarget* head,
|
2015-08-26 20:39:17 +03:00
|
|
|
bool usage_requirements_only) const;
|
|
|
|
|
2015-09-13 11:18:15 +03:00
|
|
|
typedef std::map<std::string, std::vector<cmSourceFile*> >
|
|
|
|
SourceFilesMapType;
|
|
|
|
mutable SourceFilesMapType SourceFilesMap;
|
|
|
|
|
2015-08-05 00:14:53 +03:00
|
|
|
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
|
2015-08-05 00:43:56 +03:00
|
|
|
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
|
2015-08-05 00:48:58 +03:00
|
|
|
std::vector<TargetPropertyEntry*> CompileFeaturesEntries;
|
2015-08-05 01:00:53 +03:00
|
|
|
std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
|
2015-09-13 11:18:15 +03:00
|
|
|
std::vector<TargetPropertyEntry*> SourceEntries;
|
2015-08-05 19:41:53 +03:00
|
|
|
mutable std::set<std::string> LinkImplicitNullProperties;
|
2015-08-05 00:14:53 +03:00
|
|
|
|
2015-08-04 20:22:30 +03:00
|
|
|
void ExpandLinkItems(std::string const& prop, std::string const& value,
|
2015-09-16 06:07:31 +03:00
|
|
|
std::string const& config,
|
|
|
|
const cmGeneratorTarget* headTarget,
|
2015-08-04 20:22:30 +03:00
|
|
|
bool usage_requirements_only,
|
|
|
|
std::vector<cmLinkItem>& items,
|
|
|
|
bool& hadHeadSensitiveCondition) const;
|
|
|
|
void LookupLinkItems(std::vector<std::string> const& names,
|
|
|
|
std::vector<cmLinkItem>& items) const;
|
|
|
|
|
2015-09-13 11:18:15 +03:00
|
|
|
void GetSourceFiles(std::vector<std::string>& files,
|
|
|
|
const std::string& config) const;
|
|
|
|
|
2015-08-05 19:17:55 +03:00
|
|
|
struct HeadToLinkImplementationMap:
|
2015-10-25 13:37:34 +03:00
|
|
|
public std::map<cmGeneratorTarget const*, cmOptionalLinkImplementation> {};
|
2015-08-05 19:17:55 +03:00
|
|
|
typedef std::map<std::string,
|
|
|
|
HeadToLinkImplementationMap> LinkImplMapType;
|
|
|
|
mutable LinkImplMapType LinkImplMap;
|
|
|
|
|
|
|
|
cmLinkImplementationLibraries const*
|
|
|
|
GetLinkImplementationLibrariesInternal(const std::string& config,
|
2015-09-16 05:56:37 +03:00
|
|
|
const cmGeneratorTarget* head) const;
|
2015-08-05 19:55:14 +03:00
|
|
|
bool
|
|
|
|
ComputeOutputDir(const std::string& config,
|
|
|
|
bool implib, std::string& out) const;
|
|
|
|
|
|
|
|
typedef std::map<std::string, OutputInfo> OutputInfoMapType;
|
|
|
|
mutable OutputInfoMapType OutputInfoMap;
|
2015-08-05 19:17:55 +03:00
|
|
|
|
2015-08-14 23:35:58 +03:00
|
|
|
typedef std::pair<std::string, bool> OutputNameKey;
|
|
|
|
typedef std::map<OutputNameKey, std::string> OutputNameMapType;
|
|
|
|
mutable OutputNameMapType OutputNameMap;
|
2015-10-08 02:01:38 +03:00
|
|
|
mutable std::set<cmLinkItem> UtilityItems;
|
2015-10-20 02:05:42 +03:00
|
|
|
cmPolicies::PolicyMap PolicyMap;
|
2015-08-26 20:38:57 +03:00
|
|
|
mutable bool PolicyWarnedCMP0022;
|
2015-08-05 00:14:53 +03:00
|
|
|
mutable bool DebugIncludesDone;
|
2015-08-05 00:43:56 +03:00
|
|
|
mutable bool DebugCompileOptionsDone;
|
2015-08-05 00:48:58 +03:00
|
|
|
mutable bool DebugCompileFeaturesDone;
|
2015-08-05 01:00:53 +03:00
|
|
|
mutable bool DebugCompileDefinitionsDone;
|
2015-09-13 11:18:15 +03:00
|
|
|
mutable bool DebugSourcesDone;
|
|
|
|
mutable bool LinkImplementationLanguageIsContextDependent;
|
2015-10-08 02:01:38 +03:00
|
|
|
mutable bool UtilityItemsDone;
|
2015-10-20 01:44:15 +03:00
|
|
|
bool DLLPlatform;
|
2015-08-14 23:35:58 +03:00
|
|
|
|
2015-08-05 20:01:23 +03:00
|
|
|
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
|
|
|
|
std::string& out) const;
|
|
|
|
|
2015-08-04 20:19:44 +03:00
|
|
|
public:
|
2015-10-08 02:45:44 +03:00
|
|
|
const std::vector<const cmGeneratorTarget*>&
|
|
|
|
GetLinkImplementationClosure(const std::string& config) const;
|
2015-08-04 20:19:44 +03:00
|
|
|
|
2015-08-05 19:17:55 +03:00
|
|
|
mutable std::map<std::string, std::string> MaxLanguageStandards;
|
|
|
|
std::map<std::string, std::string> const&
|
|
|
|
GetMaxLanguageStandards() const
|
|
|
|
{
|
|
|
|
return this->MaxLanguageStandards;
|
|
|
|
}
|
2015-10-21 20:51:50 +03:00
|
|
|
|
|
|
|
struct StrictTargetComparison {
|
|
|
|
bool operator()(cmGeneratorTarget const* t1,
|
|
|
|
cmGeneratorTarget const* t2) const;
|
|
|
|
};
|
2012-03-07 20:44:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|