From c6a8e4c71ad56df8f7de30bfed3a3d9d62419325 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 9 Mar 2011 09:52:46 -0500 Subject: [PATCH 1/2] The link interface of MODULE libraries is empty (#11945) MODULE libraries cannot be linked into other libraries and executables (just like executables without ENABLE_EXPORTS). Set the MODULE target link interface to be empty. This allows such targets to be installed in an EXPORT set without including all their private implementation dependencies. --- Source/cmTarget.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 72efce308..b5900c474 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4278,9 +4278,13 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface) } } - // There is no implicit link interface for executables, so if none - // was explicitly set, there is no link interface. - if(!explicitLibraries && this->GetType() == cmTarget::EXECUTABLE) + // There is no implicit link interface for executables or modules + // so if none was explicitly set then there is no link interface. + // Note that CMake versions 2.2 and below allowed linking to modules. + bool canLinkModules = this->Makefile->NeedBackwardsCompatibility(2,2); + if(!explicitLibraries && + (this->GetType() == cmTarget::EXECUTABLE || + this->GetType() == cmTarget::MODULE_LIBRARY && !canLinkModules)) { return false; } From c9d55ae5b9dceb90c735df72b7c487d0a75b2b62 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Mar 2011 15:34:26 -0400 Subject: [PATCH 2/2] Add parens in cmTarget::ComputeLinkInterface logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid GCC warning warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] added by commit c6a8e4c7 (The link interface of MODULE libraries is empty, 2011-03-09). --- Source/cmTarget.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b5900c474..e8593a10a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4284,7 +4284,7 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface) bool canLinkModules = this->Makefile->NeedBackwardsCompatibility(2,2); if(!explicitLibraries && (this->GetType() == cmTarget::EXECUTABLE || - this->GetType() == cmTarget::MODULE_LIBRARY && !canLinkModules)) + (this->GetType() == cmTarget::MODULE_LIBRARY && !canLinkModules))) { return false; }