diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-01-04 12:31:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-01-08 13:53:25 (GMT) |
commit | 40cf3fb95bc391519c0db4be1dc03c49e040579f (patch) | |
tree | 5fde04aaf1737fcf0f60e709d5b01e2002608fa3 /Source/cmTarget.h | |
parent | 894f52f32d96ae92df0ba3dac2a70fe9c87e818d (diff) | |
download | CMake-40cf3fb95bc391519c0db4be1dc03c49e040579f.zip CMake-40cf3fb95bc391519c0db4be1dc03c49e040579f.tar.gz CMake-40cf3fb95bc391519c0db4be1dc03c49e040579f.tar.bz2 |
Make linking APIs aware of 'head' target
The 'head' is the dependent target to be linked with the current target.
It will be used to evaluate generator expressions with proper handling
of mapped configurations and is used as the source target of properties.
This requires that memoization is done with a key of a pair of target
and config, instead of just config, because now the result also depends
on the target. Removing the memoization entirely is not an option
because it slows cmake down considerably.
Diffstat (limited to 'Source/cmTarget.h')
-rw-r--r-- | Source/cmTarget.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 52d5ca6..29c73b6 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -25,11 +25,13 @@ class cmSourceFile; class cmGlobalGenerator; class cmComputeLinkInformation; class cmListFileBacktrace; +class cmTarget; struct cmTargetLinkInformationMap: - public std::map<cmStdString, cmComputeLinkInformation*> + public std::map<std::pair<cmTarget*, std::string>, cmComputeLinkInformation*> { - typedef std::map<cmStdString, cmComputeLinkInformation*> derived; + typedef std::map<std::pair<cmTarget*, std::string>, + cmComputeLinkInformation*> derived; cmTargetLinkInformationMap() {} cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r); ~cmTargetLinkInformationMap(); @@ -258,7 +260,8 @@ public: /** Get the link interface for the given configuration. Returns 0 if the target cannot be linked. */ - LinkInterface const* GetLinkInterface(const char* config); + LinkInterface const* GetLinkInterface(const char* config, + cmTarget *headTarget); /** The link implementation specifies the direct library dependencies needed by the object files of the target. */ @@ -274,7 +277,8 @@ public: // Needed only for OLD behavior of CMP0003. std::vector<std::string> WrongConfigLibraries; }; - LinkImplementation const* GetLinkImplementation(const char* config); + LinkImplementation const* GetLinkImplementation(const char* config, + cmTarget *head); /** Link information from the transitive closure of the link implementation and the interfaces of its dependencies. */ @@ -286,7 +290,7 @@ public: // Languages whose runtime libraries must be linked. std::vector<std::string> Languages; }; - LinkClosure const* GetLinkClosure(const char* config); + LinkClosure const* GetLinkClosure(const char* config, cmTarget *head); /** Strip off leading and trailing whitespace from an item named in the link dependencies of this target. */ @@ -331,7 +335,7 @@ public: bool FindSourceFiles(); ///! Return the preferred linker language for this target - const char* GetLinkerLanguage(const char* config = 0); + const char* GetLinkerLanguage(const char* config = 0, cmTarget *head = 0); /** Get the full name of the target according to the settings in its makefile. */ @@ -399,7 +403,8 @@ public: std::string GetInstallNameDirForInstallTree(const char* config, bool for_xcode = false); - cmComputeLinkInformation* GetLinkInformation(const char* config); + cmComputeLinkInformation* GetLinkInformation(const char* config, + cmTarget *head = 0); // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; @@ -597,16 +602,19 @@ private: // Cache import information from properties for each configuration. struct ImportInfo; - ImportInfo const* GetImportInfo(const char* config); - void ComputeImportInfo(std::string const& desired_config, ImportInfo& info); + ImportInfo const* GetImportInfo(const char* config, + cmTarget *workingTarget); + void ComputeImportInfo(std::string const& desired_config, ImportInfo& info, + cmTarget *head); cmTargetLinkInformationMap LinkInformation; - bool ComputeLinkInterface(const char* config, LinkInterface& iface); + bool ComputeLinkInterface(const char* config, LinkInterface& iface, + cmTarget *head); void ComputeLinkImplementation(const char* config, - LinkImplementation& impl); - void ComputeLinkClosure(const char* config, LinkClosure& lc); + LinkImplementation& impl, cmTarget *head); + void ComputeLinkClosure(const char* config, LinkClosure& lc, cmTarget *head); void ClearLinkMaps(); |