2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2001-04-11 22:59:02 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2001-04-11 22:59:02 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
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.
|
|
|
|
============================================================================*/
|
2001-04-11 22:59:02 +04:00
|
|
|
#ifndef cmTarget_h
|
|
|
|
#define cmTarget_h
|
|
|
|
|
|
|
|
#include "cmCustomCommand.h"
|
2006-12-07 17:45:32 +03:00
|
|
|
#include "cmPropertyMap.h"
|
2008-03-13 23:23:18 +03:00
|
|
|
#include "cmPolicies.h"
|
2013-02-12 13:35:28 +04:00
|
|
|
#include "cmListFileCache.h"
|
2015-08-04 20:49:49 +03:00
|
|
|
#include "cmLinkItem.h"
|
2005-02-19 00:12:08 +03:00
|
|
|
|
2009-07-07 00:24:32 +04:00
|
|
|
#include <cmsys/auto_ptr.hxx>
|
2014-06-10 21:07:24 +04:00
|
|
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
2015-05-16 07:57:53 +03:00
|
|
|
# ifdef CMake_HAVE_CXX11_UNORDERED_MAP
|
|
|
|
# include <unordered_map>
|
|
|
|
# else
|
|
|
|
# include <cmsys/hash_map.hxx>
|
|
|
|
# endif
|
2014-06-10 21:07:24 +04:00
|
|
|
#endif
|
2009-07-07 00:24:32 +04:00
|
|
|
|
2013-06-28 13:25:40 +04:00
|
|
|
#define CM_FOR_EACH_TARGET_POLICY(F) \
|
|
|
|
F(CMP0003) \
|
|
|
|
F(CMP0004) \
|
|
|
|
F(CMP0008) \
|
|
|
|
F(CMP0020) \
|
|
|
|
F(CMP0021) \
|
2013-11-26 14:24:47 +04:00
|
|
|
F(CMP0022) \
|
2014-03-06 18:18:37 +04:00
|
|
|
F(CMP0027) \
|
|
|
|
F(CMP0038) \
|
2013-12-19 08:25:29 +04:00
|
|
|
F(CMP0041) \
|
2014-03-06 18:18:37 +04:00
|
|
|
F(CMP0042) \
|
2014-03-31 19:37:02 +04:00
|
|
|
F(CMP0046) \
|
2015-04-07 17:43:47 +03:00
|
|
|
F(CMP0052) \
|
2015-05-22 21:01:44 +03:00
|
|
|
F(CMP0060) \
|
2015-08-24 21:33:31 +03:00
|
|
|
F(CMP0063) \
|
|
|
|
F(CMP0065)
|
2013-06-28 13:25:40 +04:00
|
|
|
|
2006-12-07 17:45:32 +03:00
|
|
|
class cmake;
|
2005-02-19 00:12:08 +03:00
|
|
|
class cmMakefile;
|
2002-09-28 00:24:10 +04:00
|
|
|
class cmSourceFile;
|
2004-09-22 22:42:05 +04:00
|
|
|
class cmGlobalGenerator;
|
2012-11-05 19:14:02 +04:00
|
|
|
class cmComputeLinkInformation;
|
2008-03-13 20:48:57 +03:00
|
|
|
class cmListFileBacktrace;
|
2013-01-04 16:31:01 +04:00
|
|
|
class cmTarget;
|
2012-10-11 02:57:11 +04:00
|
|
|
class cmGeneratorTarget;
|
|
|
|
class cmTargetTraceDependencies;
|
2001-04-11 22:59:02 +04:00
|
|
|
|
2008-02-19 00:38:34 +03:00
|
|
|
class cmTargetInternals;
|
|
|
|
class cmTargetInternalPointer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cmTargetInternalPointer();
|
|
|
|
cmTargetInternalPointer(cmTargetInternalPointer const& r);
|
|
|
|
~cmTargetInternalPointer();
|
|
|
|
cmTargetInternalPointer& operator=(cmTargetInternalPointer const& r);
|
|
|
|
cmTargetInternals* operator->() const { return this->Pointer; }
|
2009-09-07 18:11:43 +04:00
|
|
|
cmTargetInternals* Get() const { return this->Pointer; }
|
2008-02-19 00:38:34 +03:00
|
|
|
private:
|
|
|
|
cmTargetInternals* Pointer;
|
|
|
|
};
|
|
|
|
|
2001-04-11 22:59:02 +04:00
|
|
|
/** \class cmTarget
|
|
|
|
* \brief Represent a library or executable target loaded from a makefile.
|
|
|
|
*
|
2007-07-02 21:32:41 +04:00
|
|
|
* cmTarget represents a target loaded from
|
2001-04-11 22:59:02 +04:00
|
|
|
* a makefile.
|
|
|
|
*/
|
|
|
|
class cmTarget
|
|
|
|
{
|
|
|
|
public:
|
2006-01-14 02:18:32 +03:00
|
|
|
cmTarget();
|
2004-02-29 02:59:19 +03:00
|
|
|
enum TargetType { EXECUTABLE, STATIC_LIBRARY,
|
2012-03-12 18:47:40 +04:00
|
|
|
SHARED_LIBRARY, MODULE_LIBRARY,
|
|
|
|
OBJECT_LIBRARY, UTILITY, GLOBAL_TARGET,
|
2012-11-02 18:47:40 +04:00
|
|
|
INTERFACE_LIBRARY,
|
2008-08-18 19:39:22 +04:00
|
|
|
UNKNOWN_LIBRARY};
|
2011-03-20 19:57:42 +03:00
|
|
|
static const char* GetTargetTypeName(TargetType targetType);
|
2003-06-03 18:30:23 +04:00
|
|
|
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
|
|
|
|
|
2001-04-19 21:28:46 +04:00
|
|
|
/**
|
2001-05-02 00:55:32 +04:00
|
|
|
* Return the type of target.
|
2001-04-19 21:28:46 +04:00
|
|
|
*/
|
2007-05-22 18:24:59 +04:00
|
|
|
TargetType GetType() const
|
2001-05-02 00:55:32 +04:00
|
|
|
{
|
2007-07-02 21:32:41 +04:00
|
|
|
return this->TargetTypeValue;
|
2001-05-02 00:55:32 +04:00
|
|
|
}
|
2007-07-02 21:32:41 +04:00
|
|
|
|
2002-11-20 02:01:05 +03:00
|
|
|
/**
|
|
|
|
* Set the target type
|
|
|
|
*/
|
2014-02-07 02:31:47 +04:00
|
|
|
void SetType(TargetType f, const std::string& name);
|
2004-09-22 22:42:05 +04:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
void MarkAsImported();
|
2007-07-02 21:32:41 +04:00
|
|
|
|
2004-09-22 22:42:05 +04:00
|
|
|
///! Set/Get the name of the target
|
2014-02-07 02:31:47 +04:00
|
|
|
const std::string& GetName() const {return this->Name;}
|
|
|
|
std::string GetExportName() const;
|
2002-11-20 02:01:05 +03:00
|
|
|
|
2005-06-22 17:06:46 +04:00
|
|
|
///! Set the cmMakefile that owns this target
|
2006-02-16 23:19:00 +03:00
|
|
|
void SetMakefile(cmMakefile *mf);
|
2014-04-03 23:35:22 +04:00
|
|
|
cmMakefile *GetMakefile() const { return this->Makefile;}
|
2007-07-02 21:32:41 +04:00
|
|
|
|
2013-06-28 13:25:40 +04:00
|
|
|
#define DECLARE_TARGET_POLICY(POLICY) \
|
|
|
|
cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
|
2015-05-02 15:50:02 +03:00
|
|
|
{ return this->PolicyMap.Get(cmPolicies::POLICY); }
|
2008-07-23 20:59:14 +04:00
|
|
|
|
2013-06-28 13:25:40 +04:00
|
|
|
CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
|
2012-11-20 17:53:41 +04:00
|
|
|
|
2013-06-28 13:25:40 +04:00
|
|
|
#undef DECLARE_TARGET_POLICY
|
2013-06-04 18:25:47 +04:00
|
|
|
|
2001-04-19 21:28:46 +04:00
|
|
|
/**
|
|
|
|
* Get the list of the custom commands for this target
|
|
|
|
*/
|
2013-11-19 14:05:47 +04:00
|
|
|
std::vector<cmCustomCommand> const &GetPreBuildCommands() const
|
2006-03-15 19:02:08 +03:00
|
|
|
{return this->PreBuildCommands;}
|
2013-11-19 14:05:47 +04:00
|
|
|
std::vector<cmCustomCommand> const &GetPreLinkCommands() const
|
2006-03-15 19:02:08 +03:00
|
|
|
{return this->PreLinkCommands;}
|
2013-11-19 14:05:47 +04:00
|
|
|
std::vector<cmCustomCommand> const &GetPostBuildCommands() const
|
2006-03-15 19:02:08 +03:00
|
|
|
{return this->PostBuildCommands;}
|
2013-11-19 14:05:47 +04:00
|
|
|
void AddPreBuildCommand(cmCustomCommand const &cmd)
|
|
|
|
{this->PreBuildCommands.push_back(cmd);}
|
|
|
|
void AddPreLinkCommand(cmCustomCommand const &cmd)
|
|
|
|
{this->PreLinkCommands.push_back(cmd);}
|
|
|
|
void AddPostBuildCommand(cmCustomCommand const &cmd)
|
|
|
|
{this->PostBuildCommands.push_back(cmd);}
|
2001-04-19 21:28:46 +04:00
|
|
|
|
2001-04-25 00:49:12 +04:00
|
|
|
/**
|
|
|
|
* Get the list of the source files used by this target
|
|
|
|
*/
|
2014-02-13 20:25:00 +04:00
|
|
|
void GetSourceFiles(std::vector<cmSourceFile*> &files,
|
2014-07-11 00:07:31 +04:00
|
|
|
const std::string& config) const;
|
2007-06-18 19:59:23 +04:00
|
|
|
/**
|
|
|
|
* Add sources to the target.
|
|
|
|
*/
|
|
|
|
void AddSources(std::vector<std::string> const& srcs);
|
2014-04-09 03:32:14 +04:00
|
|
|
void AddTracedSources(std::vector<std::string> const& srcs);
|
2014-03-17 19:54:11 +04:00
|
|
|
cmSourceFile* AddSourceCMP0049(const std::string& src);
|
2014-02-06 23:05:57 +04:00
|
|
|
cmSourceFile* AddSource(const std::string& src);
|
2007-06-18 19:59:23 +04:00
|
|
|
|
2001-04-30 18:44:00 +04:00
|
|
|
enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED};
|
2002-05-01 22:00:21 +04:00
|
|
|
|
2006-11-29 19:00:17 +03:00
|
|
|
//* how we identify a library, by name and type
|
2014-02-10 09:21:34 +04:00
|
|
|
typedef std::pair<std::string, LinkLibraryType> LibraryID;
|
2006-11-29 19:00:17 +03:00
|
|
|
|
|
|
|
typedef std::vector<LibraryID > LinkLibraryVectorType;
|
2007-06-15 18:10:24 +04:00
|
|
|
const LinkLibraryVectorType &GetOriginalLinkLibraries() const
|
2006-03-15 19:02:08 +03:00
|
|
|
{return this->OriginalLinkLibraries;}
|
2007-07-02 21:32:41 +04:00
|
|
|
|
2008-09-05 01:34:25 +04:00
|
|
|
/** Compute the link type to use for the given configuration. */
|
2014-02-10 07:48:34 +04:00
|
|
|
LinkLibraryType ComputeLinkType(const std::string& config) const;
|
2008-09-05 01:34:25 +04:00
|
|
|
|
2002-11-20 02:01:05 +03:00
|
|
|
/**
|
|
|
|
* Clear the dependency information recorded for this target, if any.
|
|
|
|
*/
|
2014-02-07 02:31:47 +04:00
|
|
|
void ClearDependencyInformation(cmMakefile& mf, const std::string& target);
|
2002-11-20 02:01:05 +03:00
|
|
|
|
2005-12-26 21:14:19 +03:00
|
|
|
// Check to see if a library is a framework and treat it different on Mac
|
2013-11-19 14:48:55 +04:00
|
|
|
bool NameResolvesToFramework(const std::string& libname) const;
|
2002-05-04 00:34:05 +04:00
|
|
|
void AddLinkLibrary(cmMakefile& mf,
|
2014-02-07 02:31:47 +04:00
|
|
|
const std::string& target, const std::string& lib,
|
2002-05-04 00:34:05 +04:00
|
|
|
LinkLibraryType llt);
|
2013-06-04 18:21:33 +04:00
|
|
|
enum TLLSignature {
|
|
|
|
KeywordTLLSignature,
|
|
|
|
PlainTLLSignature
|
|
|
|
};
|
2015-06-23 21:56:47 +03:00
|
|
|
bool PushTLLCommandTrace(TLLSignature signature,
|
|
|
|
cmListFileContext const& lfc);
|
2015-01-05 22:31:31 +03:00
|
|
|
void GetTllSignatureTraces(std::ostringstream &s, TLLSignature sig) const;
|
2002-05-04 00:34:05 +04:00
|
|
|
|
2014-02-07 02:31:47 +04:00
|
|
|
void MergeLinkLibraries( cmMakefile& mf, const std::string& selfname,
|
2006-03-15 19:02:08 +03:00
|
|
|
const LinkLibraryVectorType& libs );
|
2002-05-04 00:34:05 +04:00
|
|
|
|
2013-10-30 01:21:20 +04:00
|
|
|
const std::vector<std::string>& GetLinkDirectories() const;
|
2006-01-14 02:18:32 +03:00
|
|
|
|
2014-02-07 02:31:47 +04:00
|
|
|
void AddLinkDirectory(const std::string& d);
|
2001-05-23 19:31:43 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the path where this target should be installed. This is relative to
|
|
|
|
* INSTALL_PREFIX
|
|
|
|
*/
|
2013-11-19 14:50:23 +04:00
|
|
|
std::string GetInstallPath() const {return this->InstallPath;}
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetInstallPath(const char *name) {this->InstallPath = name;}
|
2007-07-02 21:32:41 +04:00
|
|
|
|
2004-01-27 20:37:30 +03:00
|
|
|
/**
|
|
|
|
* Set the path where this target (if it has a runtime part) should be
|
|
|
|
* installed. This is relative to INSTALL_PREFIX
|
|
|
|
*/
|
2013-11-19 14:50:23 +04:00
|
|
|
std::string GetRuntimeInstallPath() const {return this->RuntimeInstallPath;}
|
2006-05-12 22:12:13 +04:00
|
|
|
void SetRuntimeInstallPath(const char *name) {
|
2007-08-24 21:30:41 +04:00
|
|
|
this->RuntimeInstallPath = name; }
|
2006-02-20 01:27:47 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get/Set whether there is an install rule for this target.
|
|
|
|
*/
|
2013-10-30 01:21:20 +04:00
|
|
|
bool GetHaveInstallRule() const { return this->HaveInstallRule; }
|
2006-03-15 19:02:08 +03:00
|
|
|
void SetHaveInstallRule(bool h) { this->HaveInstallRule = h; }
|
2006-02-20 01:27:47 +03:00
|
|
|
|
2001-06-07 22:52:29 +04:00
|
|
|
/** Add a utility on which this project depends. A utility is an executable
|
|
|
|
* name as would be specified to the ADD_EXECUTABLE or UTILITY_SOURCE
|
2007-07-02 21:32:41 +04:00
|
|
|
* commands. It is not a full path nor does it have an extension.
|
2001-06-07 22:52:29 +04:00
|
|
|
*/
|
2014-02-07 02:31:47 +04:00
|
|
|
void AddUtility(const std::string& u, cmMakefile *makefile = 0);
|
2001-06-07 22:52:29 +04:00
|
|
|
///! Get the utilities used by this target
|
2014-02-10 09:21:34 +04:00
|
|
|
std::set<std::string>const& GetUtilities() const { return this->Utilities; }
|
2014-06-16 18:58:23 +04:00
|
|
|
std::set<cmLinkItem>const& GetUtilityItems() const;
|
2014-02-07 02:31:47 +04:00
|
|
|
cmListFileBacktrace const* GetUtilityBacktrace(const std::string& u) const;
|
2001-06-13 21:49:24 +04:00
|
|
|
|
2009-10-05 17:06:29 +04:00
|
|
|
/** Finalize the target at the end of the Configure step. */
|
|
|
|
void FinishConfigure();
|
2002-05-01 22:00:21 +04:00
|
|
|
|
2002-12-21 01:15:45 +03:00
|
|
|
///! Set/Get a property of this target file
|
2013-09-03 00:27:32 +04:00
|
|
|
void SetProperty(const std::string& prop, const char *value);
|
|
|
|
void AppendProperty(const std::string& prop, const char* value,
|
|
|
|
bool asString=false);
|
|
|
|
const char *GetProperty(const std::string& prop) const;
|
2014-05-09 18:50:29 +04:00
|
|
|
const char *GetProperty(const std::string& prop, cmMakefile* context) const;
|
2013-09-03 00:27:32 +04:00
|
|
|
bool GetPropertyAsBool(const std::string& prop) const;
|
|
|
|
void CheckProperty(const std::string& prop, cmMakefile* context) const;
|
2007-07-02 21:32:41 +04:00
|
|
|
|
2007-05-22 18:24:59 +04:00
|
|
|
bool IsImported() const {return this->IsImportedTarget;}
|
2002-12-21 01:15:45 +03:00
|
|
|
|
2014-04-13 12:07:16 +04:00
|
|
|
void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
|
|
|
|
|
2015-08-04 20:55:46 +03:00
|
|
|
cmLinkImplementationLibraries const*
|
2014-06-13 00:22:11 +04:00
|
|
|
GetLinkImplementationLibraries(const std::string& config) const;
|
2014-02-13 18:02:09 +04:00
|
|
|
|
2015-08-05 18:37:48 +03:00
|
|
|
void ComputeLinkImplementationLibraries(const std::string& config,
|
|
|
|
cmOptionalLinkImplementation& impl,
|
|
|
|
cmTarget const* head) const;
|
|
|
|
|
2015-08-05 18:37:49 +03:00
|
|
|
cmOptionalLinkImplementation&
|
|
|
|
GetLinkImplMap(std::string const& config) const;
|
|
|
|
|
2014-06-16 17:45:46 +04:00
|
|
|
cmTarget const* FindTargetToLink(std::string const& name) const;
|
|
|
|
|
2009-07-07 00:24:45 +04:00
|
|
|
/** Strip off leading and trailing whitespace from an item named in
|
|
|
|
the link dependencies of this target. */
|
2013-10-30 01:21:20 +04:00
|
|
|
std::string CheckCMP0004(std::string const& item) const;
|
2009-07-07 00:24:45 +04:00
|
|
|
|
2006-02-24 21:13:14 +03: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. */
|
2014-02-10 07:48:34 +04:00
|
|
|
std::string GetDirectory(const std::string& config = "",
|
|
|
|
bool implib = false) const;
|
2006-02-24 21:13:14 +03:00
|
|
|
|
2012-09-25 05:30:42 +04: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. */
|
2014-02-10 07:48:34 +04:00
|
|
|
std::string GetPDBDirectory(const std::string& config) const;
|
2012-09-25 05:30:42 +04:00
|
|
|
|
2014-03-10 17:42:27 +04:00
|
|
|
const char* ImportedGetLocation(const std::string& config) const;
|
2014-03-08 16:55:46 +04:00
|
|
|
|
2006-10-17 02:17:14 +04: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. */
|
2013-11-19 14:50:23 +04:00
|
|
|
void GetTargetVersion(int& major, int& minor) const;
|
2006-10-17 02:17:14 +04:00
|
|
|
|
2008-07-09 18:09:00 +04:00
|
|
|
/** 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. */
|
2013-11-19 14:50:23 +04:00
|
|
|
void
|
|
|
|
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
|
2008-07-09 18:09:00 +04:00
|
|
|
|
2013-09-19 21:03:38 +04:00
|
|
|
/** Whether this library has \@rpath and platform supports it. */
|
2014-02-10 07:48:34 +04:00
|
|
|
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
|
2013-12-19 08:25:29 +04:00
|
|
|
|
|
|
|
/** Whether this library defaults to \@rpath. */
|
|
|
|
bool MacOSXRpathInstallNameDirDefault() const;
|
2013-04-27 08:04:44 +04:00
|
|
|
|
2008-02-21 19:41:11 +03:00
|
|
|
/** Test for special case of a third-party shared library that has
|
|
|
|
no soname at all. */
|
2014-02-10 07:48:34 +04:00
|
|
|
bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
|
2008-02-21 19:41:11 +03:00
|
|
|
|
2011-12-06 01:39:07 +04:00
|
|
|
/** Does this target have a GNU implib to convert to MS format? */
|
2013-11-19 14:50:23 +04:00
|
|
|
bool HasImplibGNUtoMS() const;
|
2011-12-06 01:39:07 +04:00
|
|
|
|
|
|
|
/** 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,
|
2013-11-19 14:50:23 +04:00
|
|
|
const char* newExt = 0) const;
|
2011-12-06 01:39:07 +04:00
|
|
|
|
2013-10-30 01:21:20 +04:00
|
|
|
bool HaveInstallTreeRPATH() const;
|
2008-01-29 23:07:33 +03:00
|
|
|
|
2006-12-07 17:45:32 +03:00
|
|
|
// Get the properties
|
2014-04-03 23:35:22 +04:00
|
|
|
cmPropertyMap &GetProperties() const { return this->Properties; }
|
2006-12-07 17:45:32 +03:00
|
|
|
|
2012-12-23 14:20:37 +04:00
|
|
|
bool GetMappedConfig(std::string const& desired_config,
|
|
|
|
const char** loc,
|
|
|
|
const char** imp,
|
2013-10-30 01:21:20 +04:00
|
|
|
std::string& suffix) const;
|
2012-12-23 14:20:37 +04:00
|
|
|
|
2007-03-28 07:13:25 +04:00
|
|
|
/** Get the macro to define when building sources in this target.
|
|
|
|
If no macro should be defined null is returned. */
|
2013-11-19 14:49:42 +04:00
|
|
|
const char* GetExportMacro() const;
|
2007-03-28 07:13:25 +04:00
|
|
|
|
2008-01-28 16:38:36 +03:00
|
|
|
/** Return whether this target is an executable with symbol exports
|
|
|
|
enabled. */
|
2013-10-30 01:21:20 +04:00
|
|
|
bool IsExecutableWithExports() const;
|
2008-01-28 16:38:36 +03:00
|
|
|
|
2008-08-18 19:39:22 +04:00
|
|
|
/** Return whether this target may be used to link another target. */
|
2013-11-19 14:50:23 +04:00
|
|
|
bool IsLinkable() const;
|
2008-08-18 19:39:22 +04:00
|
|
|
|
2009-08-11 17:07:42 +04:00
|
|
|
/** Return whether or not the target is for a DLL platform. */
|
2013-11-19 14:50:23 +04:00
|
|
|
bool IsDLLPlatform() const { return this->DLLPlatform; }
|
2009-08-11 17:07:42 +04:00
|
|
|
|
|
|
|
/** Return whether or not the target has a DLL import library. */
|
2013-10-30 01:21:20 +04:00
|
|
|
bool HasImportLibrary() const;
|
2009-08-11 17:07:42 +04:00
|
|
|
|
2008-01-28 21:05:58 +03:00
|
|
|
/** Return whether this target is a shared library Framework on
|
|
|
|
Apple. */
|
2013-10-30 01:21:20 +04:00
|
|
|
bool IsFrameworkOnApple() const;
|
2008-01-28 21:05:58 +03:00
|
|
|
|
2010-10-07 06:43:04 +04:00
|
|
|
/** Return whether this target is a CFBundle (plugin) on Apple. */
|
2013-10-30 01:21:20 +04:00
|
|
|
bool IsCFBundleOnApple() const;
|
2010-10-07 06:43:04 +04:00
|
|
|
|
2015-02-25 23:07:43 +03:00
|
|
|
/** Return whether this target is a XCTest on Apple. */
|
|
|
|
bool IsXCTestOnApple() const;
|
|
|
|
|
2008-01-28 22:46:16 +03:00
|
|
|
/** Return whether this target is an executable Bundle on Apple. */
|
2013-10-30 01:21:20 +04:00
|
|
|
bool IsAppBundleOnApple() const;
|
2008-01-28 22:46:16 +03:00
|
|
|
|
2008-04-08 08:06:47 +04:00
|
|
|
/** Return the framework version string. Undefined if
|
|
|
|
IsFrameworkOnApple returns false. */
|
2013-10-30 01:21:20 +04:00
|
|
|
std::string GetFrameworkVersion() const;
|
2008-04-08 08:06:47 +04:00
|
|
|
|
2008-03-13 20:48:57 +03:00
|
|
|
/** Get a backtrace from the creation of the target. */
|
|
|
|
cmListFileBacktrace const& GetBacktrace() const;
|
|
|
|
|
2009-02-10 16:50:09 +03:00
|
|
|
/** Get a build-tree directory in which to place target support files. */
|
|
|
|
std::string GetSupportDirectory() const;
|
|
|
|
|
2011-07-18 23:25:30 +04:00
|
|
|
/** Return whether this target uses the default value for its output
|
|
|
|
directory. */
|
2014-02-10 07:48:34 +04:00
|
|
|
bool UsesDefaultOutputDir(const std::string& config, bool implib) const;
|
2011-07-18 23:25:30 +04:00
|
|
|
|
2012-07-16 21:42:56 +04:00
|
|
|
/** @return whether this target have a well defined output file name. */
|
2013-10-30 01:21:20 +04:00
|
|
|
bool HaveWellDefinedOutputFiles() const;
|
2012-07-16 21:42:56 +04:00
|
|
|
|
2015-07-09 00:35:01 +03:00
|
|
|
void InsertInclude(std::string const& entry,
|
|
|
|
cmListFileBacktrace const& bt,
|
2012-11-20 01:47:30 +04:00
|
|
|
bool before = false);
|
2015-07-09 00:17:16 +03:00
|
|
|
void InsertCompileOption(std::string const& entry,
|
|
|
|
cmListFileBacktrace const& bt,
|
|
|
|
bool before = false);
|
2015-07-09 00:11:22 +03:00
|
|
|
void InsertCompileDefinition(std::string const& entry,
|
|
|
|
cmListFileBacktrace const& bt);
|
2012-11-05 17:48:42 +04:00
|
|
|
|
2013-01-12 15:11:29 +04:00
|
|
|
void AppendBuildInterfaceIncludes();
|
|
|
|
|
2013-10-30 01:21:20 +04:00
|
|
|
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
|
2012-11-05 15:43:28 +04:00
|
|
|
|
|
|
|
std::string GetDebugGeneratorExpressions(const std::string &value,
|
2013-11-19 14:50:23 +04:00
|
|
|
cmTarget::LinkLibraryType llt) const;
|
2013-07-02 00:55:25 +04:00
|
|
|
|
2014-02-10 09:21:34 +04:00
|
|
|
void AddSystemIncludeDirectories(const std::set<std::string> &incs);
|
|
|
|
std::set<std::string> const & GetSystemIncludeDirectories() const
|
2013-07-02 00:55:25 +04:00
|
|
|
{ return this->SystemIncludeDirectories; }
|
2013-07-02 16:30:10 +04:00
|
|
|
|
2013-07-25 11:12:28 +04:00
|
|
|
bool LinkLanguagePropagatesToDependents() const
|
|
|
|
{ return this->TargetTypeValue == STATIC_LIBRARY; }
|
|
|
|
|
2014-05-15 13:32:30 +04:00
|
|
|
std::map<std::string, std::string> const&
|
|
|
|
GetMaxLanguageStandards() const
|
|
|
|
{
|
|
|
|
return this->MaxLanguageStandards;
|
|
|
|
}
|
|
|
|
|
2015-08-05 00:14:53 +03:00
|
|
|
cmStringRange GetIncludeDirectoriesEntries() const;
|
|
|
|
cmBacktraceRange GetIncludeDirectoriesBacktraces() const;
|
|
|
|
|
2015-08-05 00:43:56 +03:00
|
|
|
cmStringRange GetCompileOptionsEntries() const;
|
|
|
|
cmBacktraceRange GetCompileOptionsBacktraces() const;
|
|
|
|
|
2015-08-05 00:48:58 +03:00
|
|
|
cmStringRange GetCompileFeaturesEntries() const;
|
|
|
|
cmBacktraceRange GetCompileFeaturesBacktraces() const;
|
|
|
|
|
2015-08-05 01:00:53 +03:00
|
|
|
cmStringRange GetCompileDefinitionsEntries() const;
|
|
|
|
cmBacktraceRange GetCompileDefinitionsBacktraces() const;
|
|
|
|
|
2014-07-14 22:39:20 +04:00
|
|
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
|
|
const LinkLibraryVectorType &GetLinkLibrariesForVS6() const {
|
|
|
|
return this->LinkLibrariesForVS6;}
|
|
|
|
#endif
|
|
|
|
|
2002-05-01 22:00:21 +04:00
|
|
|
private:
|
2014-05-09 18:50:29 +04:00
|
|
|
bool HandleLocationPropertyPolicy(cmMakefile* context) const;
|
2013-06-28 18:37:39 +04:00
|
|
|
|
2014-07-14 22:39:20 +04:00
|
|
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
2002-11-20 02:01:05 +03:00
|
|
|
/**
|
|
|
|
* A list of direct dependencies. Use in conjunction with DependencyMap.
|
|
|
|
*/
|
2006-11-29 19:00:17 +03:00
|
|
|
typedef std::vector< LibraryID > DependencyList;
|
2002-11-20 02:01:05 +03:00
|
|
|
|
2002-05-01 22:00:21 +04:00
|
|
|
/**
|
|
|
|
* This map holds the dependency graph. map[x] returns a set of
|
2002-11-20 02:01:05 +03:00
|
|
|
* direct dependencies of x. Note that the direct depenencies are
|
|
|
|
* ordered. This is necessary to handle direct dependencies that
|
|
|
|
* themselves have no dependency information.
|
2002-05-01 22:00:21 +04:00
|
|
|
*/
|
2006-11-29 19:00:17 +03:00
|
|
|
typedef std::map< LibraryID, DependencyList > DependencyMap;
|
2002-05-02 21:41:40 +04:00
|
|
|
|
2002-05-01 22:00:21 +04:00
|
|
|
/**
|
2002-11-20 02:01:05 +03:00
|
|
|
* Inserts \a dep at the end of the dependency list of \a lib.
|
|
|
|
*/
|
2014-07-14 22:21:54 +04:00
|
|
|
void InsertDependencyForVS6( DependencyMap& depMap,
|
|
|
|
const LibraryID& lib,
|
|
|
|
const LibraryID& dep);
|
2002-11-20 02:01:05 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Deletes \a dep from the dependency list of \a lib.
|
|
|
|
*/
|
2014-07-14 22:21:54 +04:00
|
|
|
void DeleteDependencyForVS6( DependencyMap& depMap,
|
|
|
|
const LibraryID& lib,
|
|
|
|
const LibraryID& dep);
|
2002-11-20 02:01:05 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Emits the library \a lib and all its dependencies into link_line.
|
|
|
|
* \a emitted keeps track of the libraries that have been emitted to
|
|
|
|
* avoid duplicates--it is more efficient than searching
|
|
|
|
* link_line. \a visited is used detect cycles. Note that \a
|
|
|
|
* link_line is in reverse order, in that the dependencies of a
|
|
|
|
* library are listed before the library itself.
|
2002-05-01 22:00:21 +04:00
|
|
|
*/
|
2014-07-14 22:21:54 +04:00
|
|
|
void EmitForVS6( const LibraryID lib,
|
|
|
|
const DependencyMap& dep_map,
|
|
|
|
std::set<LibraryID>& emitted,
|
|
|
|
std::set<LibraryID>& visited,
|
|
|
|
DependencyList& link_line);
|
2002-05-01 22:00:21 +04:00
|
|
|
|
|
|
|
/**
|
2002-11-20 02:01:05 +03:00
|
|
|
* Finds the dependencies for \a lib and inserts them into \a
|
|
|
|
* dep_map.
|
2002-05-01 22:00:21 +04:00
|
|
|
*/
|
2014-07-14 22:21:54 +04:00
|
|
|
void GatherDependenciesForVS6( const cmMakefile& mf,
|
|
|
|
const LibraryID& lib,
|
|
|
|
DependencyMap& dep_map);
|
2002-12-21 01:15:45 +03:00
|
|
|
|
2014-07-14 22:21:54 +04:00
|
|
|
void AnalyzeLibDependenciesForVS6( const cmMakefile& mf );
|
2014-07-14 22:39:20 +04:00
|
|
|
#endif
|
2009-10-05 17:06:29 +04:00
|
|
|
|
2013-10-30 01:21:20 +04:00
|
|
|
const char* GetSuffixVariableInternal(bool implib) const;
|
|
|
|
const char* GetPrefixVariableInternal(bool implib) const;
|
2007-07-02 21:32:41 +04:00
|
|
|
|
2006-02-16 23:19:00 +03:00
|
|
|
// Use a makefile variable to set a default for the given property.
|
|
|
|
// If the variable is not defined use the given default instead.
|
2013-09-03 00:27:32 +04:00
|
|
|
void SetPropertyDefault(const std::string& property,
|
|
|
|
const char* default_value);
|
2006-12-07 17:45:32 +03:00
|
|
|
|
2009-05-01 17:45:19 +04:00
|
|
|
// Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type.
|
2013-10-30 01:21:20 +04:00
|
|
|
const char* GetOutputTargetType(bool implib) const;
|
2009-05-01 17:45:19 +04:00
|
|
|
|
2014-02-10 07:48:34 +04:00
|
|
|
std::string GetFullNameImported(const std::string& config,
|
|
|
|
bool implib) const;
|
2007-07-02 21:32:41 +04:00
|
|
|
|
2014-02-10 07:48:34 +04:00
|
|
|
std::string ImportedGetFullPath(const std::string& config,
|
|
|
|
bool implib) const;
|
2008-01-28 16:38:36 +03:00
|
|
|
|
2013-05-06 06:19:05 +04:00
|
|
|
|
2014-04-05 14:35:43 +04:00
|
|
|
void GetSourceFiles(std::vector<std::string> &files,
|
2014-07-11 00:07:31 +04:00
|
|
|
const std::string& config) const;
|
2001-04-19 21:28:46 +04:00
|
|
|
private:
|
2015-06-06 10:44:47 +03:00
|
|
|
mutable cmPropertyMap Properties;
|
|
|
|
std::set<std::string> SystemIncludeDirectories;
|
|
|
|
std::set<std::string> LinkDirectoriesEmmitted;
|
|
|
|
std::set<std::string> Utilities;
|
|
|
|
mutable std::set<std::string> LinkImplicitNullProperties;
|
|
|
|
std::map<std::string, cmListFileBacktrace> UtilityBacktraces;
|
|
|
|
mutable std::map<std::string, std::string> MaxLanguageStandards;
|
|
|
|
cmPolicies::PolicyMap PolicyMap;
|
2006-03-15 19:02:08 +03:00
|
|
|
std::string Name;
|
2015-06-06 10:44:47 +03:00
|
|
|
std::string InstallPath;
|
|
|
|
std::string RuntimeInstallPath;
|
|
|
|
mutable std::string ExportMacro;
|
|
|
|
std::vector<std::string> LinkDirectories;
|
2006-03-15 19:02:08 +03:00
|
|
|
std::vector<cmCustomCommand> PreBuildCommands;
|
|
|
|
std::vector<cmCustomCommand> PreLinkCommands;
|
|
|
|
std::vector<cmCustomCommand> PostBuildCommands;
|
2015-06-06 10:44:47 +03:00
|
|
|
std::vector<std::pair<TLLSignature, cmListFileContext> > TLLCommands;
|
2006-03-15 19:02:08 +03:00
|
|
|
LinkLibraryVectorType PrevLinkedLibraries;
|
2015-06-06 10:44:47 +03:00
|
|
|
LinkLibraryVectorType OriginalLinkLibraries;
|
2014-07-14 22:39:20 +04:00
|
|
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
|
|
LinkLibraryVectorType LinkLibrariesForVS6;
|
|
|
|
#endif
|
2015-06-06 10:44:47 +03:00
|
|
|
cmMakefile* Makefile;
|
|
|
|
cmTargetInternalPointer Internal;
|
|
|
|
TargetType TargetTypeValue;
|
2006-03-15 19:02:08 +03:00
|
|
|
bool HaveInstallRule;
|
2007-07-02 21:32:41 +04:00
|
|
|
bool RecordDependencies;
|
2007-03-19 17:00:36 +03:00
|
|
|
bool DLLPlatform;
|
2014-07-24 23:03:04 +04:00
|
|
|
bool IsAndroid;
|
2011-12-02 01:21:25 +04:00
|
|
|
bool IsApple;
|
2007-05-22 18:24:59 +04:00
|
|
|
bool IsImportedTarget;
|
2015-06-06 10:44:47 +03:00
|
|
|
bool BuildInterfaceIncludesAppended;
|
2014-03-27 16:16:59 +04:00
|
|
|
mutable bool DebugSourcesDone;
|
2015-06-06 10:44:47 +03:00
|
|
|
mutable bool LinkImplementationLanguageIsContextDependent;
|
|
|
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
|
|
bool LinkLibrariesForVS6Analyzed;
|
|
|
|
#endif
|
2006-01-14 02:18:32 +03:00
|
|
|
|
2009-07-03 18:33:59 +04:00
|
|
|
// Cache target output paths for each configuration.
|
2009-07-08 16:31:30 +04:00
|
|
|
struct OutputInfo;
|
2014-02-10 07:48:34 +04:00
|
|
|
OutputInfo const* GetOutputInfo(const std::string& config) const;
|
2013-10-30 01:21:20 +04:00
|
|
|
bool
|
2014-02-10 07:48:34 +04:00
|
|
|
ComputeOutputDir(const std::string& config,
|
|
|
|
bool implib, std::string& out) const;
|
2014-02-22 04:05:55 +04:00
|
|
|
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
|
2014-02-24 23:09:05 +04:00
|
|
|
std::string& out) const;
|
2009-07-03 18:33:59 +04:00
|
|
|
|
2008-01-28 16:38:36 +03:00
|
|
|
// Cache import information from properties for each configuration.
|
2015-08-04 20:19:41 +03:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2014-06-16 18:36:21 +04:00
|
|
|
ImportInfo const* GetImportInfo(const std::string& config) const;
|
|
|
|
void ComputeImportInfo(std::string const& desired_config,
|
|
|
|
ImportInfo& info) const;
|
2008-01-28 16:38:36 +03:00
|
|
|
|
2015-08-04 20:55:46 +03:00
|
|
|
cmLinkImplementationLibraries const*
|
2014-06-13 00:22:11 +04:00
|
|
|
GetLinkImplementationLibrariesInternal(const std::string& config,
|
|
|
|
cmTarget const* head) const;
|
2014-06-16 19:31:11 +04:00
|
|
|
|
2014-04-04 19:45:28 +04:00
|
|
|
std::string ProcessSourceItemCMP0049(const std::string& s);
|
|
|
|
|
2009-10-05 17:06:59 +04:00
|
|
|
void ClearLinkMaps();
|
|
|
|
|
2013-09-03 00:27:32 +04:00
|
|
|
void MaybeInvalidatePropertyCache(const std::string& prop);
|
2009-10-05 17:06:44 +04:00
|
|
|
|
2008-02-19 00:38:34 +03:00
|
|
|
// Internal representation details.
|
|
|
|
friend class cmTargetInternals;
|
2012-10-11 02:57:11 +04:00
|
|
|
friend class cmGeneratorTarget;
|
|
|
|
friend class cmTargetTraceDependencies;
|
2008-02-19 00:38:34 +03:00
|
|
|
|
2011-12-02 01:21:25 +04:00
|
|
|
void ComputeVersionedName(std::string& vName,
|
|
|
|
std::string const& prefix,
|
|
|
|
std::string const& base,
|
|
|
|
std::string const& suffix,
|
|
|
|
std::string const& name,
|
2013-10-30 01:21:20 +04:00
|
|
|
const char* version) const;
|
2001-04-11 22:59:02 +04:00
|
|
|
};
|
|
|
|
|
2014-06-10 21:07:24 +04:00
|
|
|
#ifdef CMAKE_BUILD_WITH_CMAKE
|
2015-05-16 07:57:53 +03:00
|
|
|
#ifdef CMake_HAVE_CXX11_UNORDERED_MAP
|
|
|
|
typedef std::unordered_map<std::string, cmTarget> cmTargets;
|
|
|
|
#else
|
|
|
|
typedef cmsys::hash_map<std::string, cmTarget> cmTargets;
|
|
|
|
#endif
|
2014-06-10 21:07:24 +04:00
|
|
|
#else
|
2014-02-10 09:21:34 +04:00
|
|
|
typedef std::map<std::string,cmTarget> cmTargets;
|
2014-06-10 21:07:24 +04:00
|
|
|
#endif
|
2001-04-11 22:59:02 +04:00
|
|
|
|
2014-02-10 09:21:34 +04:00
|
|
|
class cmTargetSet: public std::set<std::string> {};
|
|
|
|
class cmTargetManifest: public std::map<std::string, cmTargetSet> {};
|
2006-04-04 19:48:19 +04:00
|
|
|
|
2001-04-11 22:59:02 +04:00
|
|
|
#endif
|