[Cmake-commits] CMake branch, next, updated. v2.8.10.1-982-g196ba44
Stephen Kelly
steveire at gmail.com
Thu Nov 22 12:06:44 EST 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 196ba440fdd13ee73a2e27fab016d728ac4e405c (commit)
via 38979127889795968aad7475550e0c099010d8d3 (commit)
from 00f2660302c6b86f63e58c3181684acbd5ad8885 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=196ba440fdd13ee73a2e27fab016d728ac4e405c
commit 196ba440fdd13ee73a2e27fab016d728ac4e405c
Merge: 00f2660 3897912
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Nov 22 12:06:42 2012 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Nov 22 12:06:42 2012 -0500
Merge topic 'add-INTERFACE_LINK_LIBRARIES-property' into next
3897912 Genex: Add INTERFACE_LINK_LIBRARIES property
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38979127889795968aad7475550e0c099010d8d3
commit 38979127889795968aad7475550e0c099010d8d3
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Nov 1 00:32:10 2012 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Nov 22 18:05:56 2012 +0100
Genex: Add INTERFACE_LINK_LIBRARIES property
This new property is a replacement for
the (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? properties as
it can contain generator expressions. It is also part of the generated
IMPORTED targets generated by the export() and install(EXPORT) commands.
User code may already populate
the (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? properties, so
policy CMP0019 is added to handle that.
If the policy is NEW, the old properties are ignored and
the INTERFACE_LINK_LIBRARIES property is used.
Otherwise if the policy is OLD the old properties are used and the
new INTERFACE_LINK_LIBRARIES is ignored.
The policy emits a warning if the old-style property and new-style
property differ in their content.
The policy also affects the IMPORTED targets generated by export()
and install(EXPORT). If the policy is NEW, that means that the user
has bumped their cmake requirement to 2.8.11. As we'll therefore be
generating INTERFACE_LINK_LIBRARIES properties in the IMPORTED
targets, we need to ensure that consumers can use the new property,
so 2.8.11 will be required for the consumers too.
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index fb3f39f..f8f412a 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmExportBuildFileGenerator.h"
#include "cmExportCommand.h"
+#include "cmGeneratorExpression.h"
//----------------------------------------------------------------------------
cmExportBuildFileGenerator::cmExportBuildFileGenerator()
@@ -27,10 +28,35 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
tei = this->Exports->begin();
tei != this->Exports->end(); ++tei)
{
+ if ((*tei)->GetPolicyStatusCMP0019() == cmPolicies::NEW)
+ {
+ os << "IF(NOT POLICY CMP0019)\n"
+ << " MESSAGE(FATAL_ERROR \"CMake >= 2.8.11 required to use "
+ "IMPORTED targets containing generator expressions\")\n"
+ << "ENDIF(NOT POLICY CMP0019)\n";
+ break;
+ }
+ }
+
+ for(std::vector<cmTarget*>::const_iterator
+ tei = this->Exports->begin();
+ tei != this->Exports->end(); ++tei)
+ {
cmTarget* te = *tei;
if(this->ExportedTargets.insert(te).second)
{
this->GenerateImportTargetCode(os, te);
+
+ if ((*tei)->GetPolicyStatusCMP0019() == cmPolicies::NEW)
+ {
+ ImportPropertyMap properties;
+
+ this->PopulateInterfaceProperty("INTERFACE_LINK_LIBRARIES", te,
+ cmGeneratorExpression::BuildInterface,
+ properties);
+
+ this->GenerateInterfaceProperties(te, os, properties);
+ }
}
else
{
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 8dffae4..50db180 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -125,6 +125,50 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
}
//----------------------------------------------------------------------------
+void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
+ cmTarget *target,
+ cmGeneratorExpression::PreprocessContext preprocessRule,
+ ImportPropertyMap &properties)
+{
+ const char *input = target->GetProperty(propName);
+ if (input)
+ {
+ if (!*input)
+ {
+ // Set to empty
+ properties[propName] = "";
+ return;
+ }
+ std::string prepro = cmGeneratorExpression::Preprocess(input,
+ preprocessRule,
+ this->Namespace.c_str());
+ if (!prepro.empty())
+ {
+ properties[propName] = prepro;
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget *target,
+ std::ostream& os,
+ const ImportPropertyMap &properties)
+{
+ if (!properties.empty())
+ {
+ std::string targetName = this->Namespace;
+ targetName += target->GetName();
+ os << "SET_TARGET_PROPERTIES(" << targetName << " PROPERTIES\n";
+ for(ImportPropertyMap::const_iterator pi = properties.begin();
+ pi != properties.end(); ++pi)
+ {
+ os << " " << pi->first << " \"" << pi->second << "\"\n";
+ }
+ os << ")\n\n";
+ }
+}
+
+//----------------------------------------------------------------------------
void
cmExportFileGenerator
::SetImportDetailProperties(const char* config, std::string const& suffix,
@@ -167,9 +211,13 @@ cmExportFileGenerator
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES",
iface->Languages, properties, missingTargets);
- this->SetImportLinkProperty(suffix, target,
+
+ if(target->GetPolicyStatusCMP0019() != cmPolicies::NEW)
+ {
+ this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LIBRARIES",
iface->Libraries, properties, missingTargets);
+ }
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_DEPENDENT_LIBRARIES",
iface->SharedDeps, properties, missingTargets);
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 70bc65d..3aee1b8 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -13,6 +13,7 @@
#define cmExportFileGenerator_h
#include "cmCommand.h"
+#include "cmGeneratorExpression.h"
/** \class cmExportFileGenerator
* \brief Generate a file exporting targets from a build or install tree.
@@ -91,6 +92,12 @@ protected:
cmMakefile* mf,
cmTarget* depender,
cmTarget* dependee) = 0;
+ void PopulateInterfaceProperty(const char *,
+ cmTarget *target,
+ cmGeneratorExpression::PreprocessContext,
+ ImportPropertyMap &properties);
+ void GenerateInterfaceProperties(cmTarget *target, std::ostream& os,
+ const ImportPropertyMap &properties);
// The namespace in which the exports are placed in the generated file.
std::string Namespace;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 7841731..4d99866 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmTargetExport.h"
+#include "cmGeneratorExpression.h"
//----------------------------------------------------------------------------
cmExportInstallFileGenerator
@@ -39,6 +40,20 @@ std::string cmExportInstallFileGenerator::GetConfigImportFileGlob()
//----------------------------------------------------------------------------
bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
+ for(std::vector<cmTargetExport*>::const_iterator
+ tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
+ tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
+ {
+ if ((*tei)->Target->GetPolicyStatusCMP0019() == cmPolicies::NEW)
+ {
+ os << "IF(NOT POLICY CMP0019)\n"
+ << " MESSAGE(FATAL_ERROR \"CMake >= 2.8.11 required to use "
+ "IMPORTED targets containing generator expressions\")\n"
+ << "ENDIF(NOT POLICY CMP0019)\n";
+ break;
+ }
+ }
+
// Create all the imported targets.
for(std::vector<cmTargetExport*>::const_iterator
tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
@@ -48,6 +63,18 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
if(this->ExportedTargets.insert(te->Target).second)
{
this->GenerateImportTargetCode(os, te->Target);
+
+ if ((*tei)->Target->GetPolicyStatusCMP0019() == cmPolicies::NEW)
+ {
+ ImportPropertyMap properties;
+
+ this->PopulateInterfaceProperty("INTERFACE_LINK_LIBRARIES",
+ te->Target,
+ cmGeneratorExpression::InstallInterface,
+ properties);
+
+ this->GenerateInterfaceProperties(te->Target, os, properties);
+ }
}
else
{
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 6aef502..4c89dd6 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -491,6 +491,26 @@ cmPolicies::cmPolicies()
"CMAKE_SHARED_LIBRARY_<Lang>_FLAGS whether it is modified or not and "
"honor the POSITION_INDEPENDENT_CODE target property.",
2,8,9,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0019, "CMP0019",
+ "Use INTERFACE_LINK_LIBRARIES instead of LINK_INTERFACE_LIBRARIES.",
+ "CMake 2.8.10 used the (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? "
+ "properties to determine the link interface. CMake 2.8.11 and higher "
+ "prefer instead to use the INTERFACE_LINK_LIBRARIES target property to "
+ "determine the link interface, while ignoring "
+ "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? completely. The new "
+ "INTERFACE_LINK_LIBRARIES target property can use generator expressions "
+ "to specify config-specific link libraries."
+ "\n"
+ "The OLD behavior for this policy is to ignore the "
+ "INTERFACE_LINK_LIBRARIES property for all targets and use the "
+ "value of (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? instead."
+ "\n"
+ "The NEW behavior for this policy is to ignore "
+ "the value of the (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? target "
+ "property",
+ 2,8,11,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 6932565..b6b8e39 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -68,6 +68,7 @@ public:
CMP0018, ///< Ignore language flags for shared libs, and adhere to
/// POSITION_INDEPENDENT_CODE property and *_COMPILE_OPTIONS_PI{E,C}
/// instead.
+ CMP0019, ///< Use new-style INTERFACE_LINK_LIBRARIES
/** \brief Always the last entry.
*
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index be20464..59b8f0a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -21,6 +21,7 @@
#include "cmDocumentLocationUndefined.h"
#include "cmListFileCache.h"
#include "cmGeneratorExpression.h"
+#include "cmGeneratorExpressionDAGChecker.h"
#include <cmsys/RegularExpression.hxx>
#include <map>
#include <set>
@@ -127,6 +128,7 @@ cmTarget::cmTarget()
this->PolicyStatusCMP0003 = cmPolicies::WARN;
this->PolicyStatusCMP0004 = cmPolicies::WARN;
this->PolicyStatusCMP0008 = cmPolicies::WARN;
+ this->PolicyStatusCMP0019 = cmPolicies::WARN;
this->LinkLibrariesAnalyzed = false;
this->HaveInstallRule = false;
this->DLLPlatform = false;
@@ -1409,6 +1411,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->Makefile->GetPolicyStatus(cmPolicies::CMP0004);
this->PolicyStatusCMP0008 =
this->Makefile->GetPolicyStatus(cmPolicies::CMP0008);
+ this->PolicyStatusCMP0019 =
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0019);
}
//----------------------------------------------------------------------------
@@ -4238,6 +4242,28 @@ cmTarget::GetImportInfo(const char* config)
return &i->second;
}
+
+bool handleCMP0019(const std::vector<std::string> &newLinkLibraries,
+ const std::vector<std::string> &oldLinkLibraries)
+{
+ if (newLinkLibraries.size() != oldLinkLibraries.size())
+ {
+ return false;
+ }
+ for(std::vector<std::string>::const_iterator
+ oll = oldLinkLibraries.begin(), nll = newLinkLibraries.begin();
+ oll != oldLinkLibraries.end() && nll != newLinkLibraries.end();
+ ++oll, ++nll)
+ {
+ if (*oll != *nll)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+
//----------------------------------------------------------------------------
void cmTarget::ComputeImportInfo(std::string const& desired_config,
ImportInfo& info)
@@ -4441,21 +4467,79 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
// Get the link interface.
{
+ std::vector<std::string> newInterfaceLibs;
+ const char* newStyleLibsProp = this->GetProperty("INTERFACE_LINK_LIBRARIES");
+ if(newStyleLibsProp)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "INTERFACE_LINK_LIBRARIES", 0, 0);
+ cmSystemTools::ExpandListArgument(ge.Parse(newStyleLibsProp)
+ .Evaluate(this->Makefile,
+ desired_config.c_str(),
+ false,
+ this,
+ &dagChecker),
+ newInterfaceLibs);
+ }
+
std::string linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
- linkProp += suffix;
- if(const char* config_libs = this->GetProperty(linkProp.c_str()))
+ std::vector<std::string> oldInterfaceLibs;
+ const char *oldProp = this->GetProperty((linkProp + suffix).c_str());
+ if(oldProp)
{
- cmSystemTools::ExpandListArgument(config_libs,
- info.LinkInterface.Libraries);
+ linkProp += suffix;
+ cmSystemTools::ExpandListArgument(oldProp,
+ oldInterfaceLibs);
}
- else if(const char* libs =
- this->GetProperty("IMPORTED_LINK_INTERFACE_LIBRARIES"))
+ else
+ {
+ oldProp = this->GetProperty("IMPORTED_LINK_INTERFACE_LIBRARIES");
+ if(oldProp)
+ {
+ cmSystemTools::ExpandListArgument(oldProp,
+ oldInterfaceLibs);
+ }
+ }
+
+ std::vector<std::string> usedLinkLibraries;
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0019))
{
- cmSystemTools::ExpandListArgument(libs,
- info.LinkInterface.Libraries);
+ case cmPolicies::WARN:
+ {
+ if (newStyleLibsProp && oldProp
+ && !handleCMP0019(newInterfaceLibs, oldInterfaceLibs))
+ {
+ cmOStringStream e;
+ e << "The " << linkProp << " and "
+ "LINK_INTERFACE_LIBRARIES are not the same for target \""
+ << this->GetName() << "\". NEW content is \""
+ << (newStyleLibsProp ? newStyleLibsProp : "(unset)") << "\"\n"
+ "OLD content is \""
+ << (oldProp ? oldProp : "(unset)") << "\"\n"
+ << this->Makefile->GetPolicies()->GetPolicyWarning(
+ cmPolicies::CMP0019);
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ }
+ // fall through to OLD behaviour
+ }
+ case cmPolicies::OLD:
+ usedLinkLibraries = oldInterfaceLibs;
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ default:
+ usedLinkLibraries = newInterfaceLibs;
}
+ info.LinkInterface.Libraries.insert(info.LinkInterface.Libraries.end(),
+ usedLinkLibraries.begin(), usedLinkLibraries.end());
}
+
// Get the link dependencies.
{
std::string linkProp = "IMPORTED_LINK_DEPENDENT_LIBRARIES";
@@ -4562,21 +4646,82 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface)
// An explicit list of interface libraries may be set for shared
// libraries and executables that export symbols.
- const char* explicitLibraries = 0;
+ bool explicitLibraries = false;
+ std::vector<std::string> usedLinkLibraries;
if(this->GetType() == cmTarget::SHARED_LIBRARY ||
this->IsExecutableWithExports())
{
+ const char *newLibrariesProp =
+ this->GetProperty("INTERFACE_LINK_LIBRARIES");
+
+ std::vector<std::string> newInterfaceLibs;
+ std::vector<std::string> oldInterfaceLibs;
+
+ if(newLibrariesProp)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt,
+ this->GetName(),
+ "INTERFACE_LINK_LIBRARIES", 0, 0);
+
+ cmSystemTools::ExpandListArgument(ge.Parse(newLibrariesProp).Evaluate(
+ this->Makefile,
+ config,
+ false,
+ this,
+ &dagChecker), newInterfaceLibs);
+ }
// Lookup the per-configuration property.
std::string propName = "LINK_INTERFACE_LIBRARIES";
propName += suffix;
- explicitLibraries = this->GetProperty(propName.c_str());
+ const char *oldLibrariesProp = this->GetProperty(propName.c_str());
// If not set, try the generic property.
- if(!explicitLibraries)
+ if(!oldLibrariesProp)
+ {
+ oldLibrariesProp = this->GetProperty("LINK_INTERFACE_LIBRARIES");
+ }
+ if(oldLibrariesProp)
+ {
+ cmSystemTools::ExpandListArgument(oldLibrariesProp, oldInterfaceLibs);
+ }
+
+ {
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0019))
{
- explicitLibraries = this->GetProperty("LINK_INTERFACE_LIBRARIES");
+ case cmPolicies::WARN:
+ {
+ if (newLibrariesProp && oldLibrariesProp
+ && !handleCMP0019(newInterfaceLibs, oldInterfaceLibs))
+ {
+ cmOStringStream e;
+ e << "The INTERFACE_LINK_LIBRARIES and LINK_INTERFACE_LIBRARIES are "
+ "not the same for target \"" << this->GetName() << "\".\n"
+ "NEW content is \""
+ << (newLibrariesProp ? newLibrariesProp : "(unset)") << "\"\n"
+ "OLD content is \""
+ << (oldLibrariesProp ? oldLibrariesProp : "(unset)") << "\"\n"
+ << this->Makefile->GetPolicies()->GetPolicyWarning(
+ cmPolicies::CMP0019);
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ }
+ // fall through to OLD behaviour
+ }
+ case cmPolicies::OLD:
+ explicitLibraries = oldLibrariesProp ? true : false;
+ usedLinkLibraries = oldInterfaceLibs;
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ default:
+ usedLinkLibraries = newInterfaceLibs;
+ explicitLibraries = newLibrariesProp ? true : false;
}
}
+ }
// There is no implicit link interface for executables or modules
// so if none was explicitly set then there is no link interface.
@@ -4592,7 +4737,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface)
if(explicitLibraries)
{
// The interface libraries have been explicitly set.
- cmSystemTools::ExpandListArgument(explicitLibraries, iface.Libraries);
+ iface.Libraries.insert(iface.Libraries.end(),
+ usedLinkLibraries.begin(), usedLinkLibraries.end());
if(this->GetType() == cmTarget::SHARED_LIBRARY)
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 9efd638..7c55933 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -99,6 +99,10 @@ public:
cmPolicies::PolicyStatus GetPolicyStatusCMP0008() const
{ return this->PolicyStatusCMP0008; }
+ /** Get the status of policy CMP0019 when the target was created. */
+ cmPolicies::PolicyStatus GetPolicyStatusCMP0019() const
+ { return this->PolicyStatusCMP0019; }
+
/**
* Get the list of the custom commands for this target
*/
@@ -618,6 +622,7 @@ private:
cmPolicies::PolicyStatus PolicyStatusCMP0003;
cmPolicies::PolicyStatus PolicyStatusCMP0004;
cmPolicies::PolicyStatus PolicyStatusCMP0008;
+ cmPolicies::PolicyStatus PolicyStatusCMP0019;
// Internal representation details.
friend class cmTargetInternals;
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index f42b0f6..d7a1443 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -232,7 +232,11 @@ bool cmTargetLinkLibrariesCommand
{
this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
}
-
+ if(this->CurrentProcessingState != ProcessingLinkLibraries &&
+ !this->Target->GetProperty("INTERFACE_LINK_LIBRARIES"))
+ {
+ this->Target->SetProperty("INTERFACE_LINK_LIBRARIES", "");
+ }
return true;
}
@@ -250,6 +254,25 @@ cmTargetLinkLibrariesCommand
}
//----------------------------------------------------------------------------
+static std::string generatorIface(const std::string &value,
+ cmTarget::LinkLibraryType llt)
+{
+ if (llt == cmTarget::DEBUG)
+ {
+ return "$<$<CONFIG:Debug>:"
+ + value
+ + ">";
+ }
+ else if (llt == cmTarget::OPTIMIZED)
+ {
+ return "$<$<NOT:$<CONFIG:Debug>>:"
+ + value
+ + ">";
+ }
+ return value;
+}
+
+//----------------------------------------------------------------------------
void
cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
cmTarget::LinkLibraryType llt)
@@ -266,6 +289,9 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
}
}
+ this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
+ generatorIface(lib, llt).c_str());
+
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
diff --git a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
index 1faa888..95cfd15 100644
--- a/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_link_libraries/CMakeLists.txt
@@ -56,3 +56,21 @@ assert_property(targetA LINK_INTERFACE_LIBRARIES "")
target_link_libraries(targetA depB depC)
assert_property(targetA LINK_INTERFACE_LIBRARIES "")
+
+# cmake_policy(PUSH)
+
+cmake_policy(SET CMP0019 NEW)
+
+add_library(depD SHARED depD.cpp)
+generate_export_header(depD)
+set_property(TARGET depD APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<1:depA>)
+
+add_library(depE SHARED depE.cpp)
+generate_export_header(depE)
+target_link_libraries(depE LINK_PRIVATE depB)
+target_link_libraries(depE LINK_INTERFACE_LIBRARIES $<1:depB>)
+
+add_executable(targetB targetB.cpp)
+target_link_libraries(targetB depD depE)
+
+# cmake_policy(POP)
diff --git a/Tests/CMakeCommands/target_link_libraries/depD.cpp b/Tests/CMakeCommands/target_link_libraries/depD.cpp
new file mode 100644
index 0000000..b02c76c
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depD.cpp
@@ -0,0 +1,13 @@
+
+#include "depD.h"
+
+int DepD::foo()
+{
+ return 0;
+}
+
+DepA DepD::getA()
+{
+ DepA a;
+ return a;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/depD.h b/Tests/CMakeCommands/target_link_libraries/depD.h
new file mode 100644
index 0000000..d24ff5f
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depD.h
@@ -0,0 +1,11 @@
+
+#include "depd_export.h"
+
+#include "depA.h"
+
+struct DEPD_EXPORT DepD
+{
+ int foo();
+
+ DepA getA();
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/depE.cpp b/Tests/CMakeCommands/target_link_libraries/depE.cpp
new file mode 100644
index 0000000..1a3da4a
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depE.cpp
@@ -0,0 +1,13 @@
+
+#include "depE.h"
+
+int DepE::foo()
+{
+ return 0;
+}
+
+DepB DepE::getB()
+{
+ DepB a;
+ return a;
+}
diff --git a/Tests/CMakeCommands/target_link_libraries/depE.h b/Tests/CMakeCommands/target_link_libraries/depE.h
new file mode 100644
index 0000000..2273e17
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/depE.h
@@ -0,0 +1,11 @@
+
+#include "depe_export.h"
+
+#include "depB.h"
+
+struct DEPE_EXPORT DepE
+{
+ int foo();
+
+ DepB getB();
+};
diff --git a/Tests/CMakeCommands/target_link_libraries/targetB.cpp b/Tests/CMakeCommands/target_link_libraries/targetB.cpp
new file mode 100644
index 0000000..c6a1264
--- /dev/null
+++ b/Tests/CMakeCommands/target_link_libraries/targetB.cpp
@@ -0,0 +1,14 @@
+
+#include "depD.h"
+#include "depE.h"
+
+int main(int argc, char **argv)
+{
+ DepD d;
+ DepA a = d.getA();
+
+ DepE e;
+ DepB b = e.getB();
+
+ return d.foo() + a.foo() + e.foo() + b.foo();
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 722d9c3..9010aa1 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -56,6 +56,9 @@ add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(list)
add_RunCMake_test(load_command)
+if (POLICY CMP0019)
+ add_RunCMake_test(PolicyCMP0019)
+endif()
if("${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio [^6]")
add_RunCMake_test(include_external_msproject)
diff --git a/Tests/RunCMake/PolicyCMP0019/CMakeLists.txt b/Tests/RunCMake/PolicyCMP0019/CMakeLists.txt
new file mode 100644
index 0000000..22b4721
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/CMakeLists.txt
@@ -0,0 +1,8 @@
+
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} CXX)
+
+# MSVC creates extra targets which pollute the stderr unless we set this.
+set(CMAKE_SUPPRESS_REGENERATION TRUE)
+
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyNew1-result.txt b/Tests/RunCMake/PolicyCMP0019/PolicyNew1-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyNew1-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyNew1-stderr.txt b/Tests/RunCMake/PolicyCMP0019/PolicyNew1-stderr.txt
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyNew1.cmake b/Tests/RunCMake/PolicyCMP0019/PolicyNew1.cmake
new file mode 100644
index 0000000..f71d84c
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyNew1.cmake
@@ -0,0 +1,12 @@
+
+cmake_policy(SET CMP0019 NEW)
+
+add_library(foo SHARED "libfoo.cpp")
+
+add_library(bar SHARED "libbar.cpp")
+target_link_libraries(bar LINK_INTERFACE_LIBRARIES foo)
+set_property(TARGET bar APPEND PROPERTY LINK_INTERFACE_LIBRARIES blub)
+set_property(TARGET bar APPEND PROPERTY INTERFACE_LINK_LIBRARIES blah)
+
+add_executable(testexe "main.cpp")
+target_link_libraries(testexe bar)
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyOld1-result.txt b/Tests/RunCMake/PolicyCMP0019/PolicyOld1-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyOld1-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyOld1-stderr.txt b/Tests/RunCMake/PolicyCMP0019/PolicyOld1-stderr.txt
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyOld1.cmake b/Tests/RunCMake/PolicyCMP0019/PolicyOld1.cmake
new file mode 100644
index 0000000..cef458e
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyOld1.cmake
@@ -0,0 +1,12 @@
+
+# cmake_policy(SET CMP0019 OLD)
+
+add_library(foo SHARED "libfoo.cpp")
+
+add_library(bar SHARED "libbar.cpp")
+target_link_libraries(bar LINK_INTERFACE_LIBRARIES foo)
+set_property(TARGET bar APPEND PROPERTY LINK_INTERFACE_LIBRARIES blub)
+set_property(TARGET bar APPEND PROPERTY INTERFACE_LINK_LIBRARIES blah)
+
+add_executable(testexe "main.cpp")
+target_link_libraries(testexe bar)
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyOld2-result.txt b/Tests/RunCMake/PolicyCMP0019/PolicyOld2-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyOld2-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyOld2-stderr.txt b/Tests/RunCMake/PolicyCMP0019/PolicyOld2-stderr.txt
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyOld2.cmake b/Tests/RunCMake/PolicyCMP0019/PolicyOld2.cmake
new file mode 100644
index 0000000..36a8bbc
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyOld2.cmake
@@ -0,0 +1,10 @@
+
+add_library(foo SHARED "libfoo.cpp")
+
+add_library(bar SHARED "libbar.cpp")
+target_link_libraries(bar LINK_INTERFACE_LIBRARIES foo)
+set_property(TARGET bar APPEND PROPERTY LINK_INTERFACE_LIBRARIES blub)
+set_property(TARGET bar APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<1:blub>)
+
+add_executable(testexe "main.cpp")
+target_link_libraries(testexe bar)
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn1-result.txt b/Tests/RunCMake/PolicyCMP0019/PolicyWarn1-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn1-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn1-stderr.txt b/Tests/RunCMake/PolicyCMP0019/PolicyWarn1-stderr.txt
new file mode 100644
index 0000000..f2e8f90
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn1-stderr.txt
@@ -0,0 +1,13 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ The INTERFACE_LINK_LIBRARIES and LINK_INTERFACE_LIBRARIES are not the same
+ for target \"bar\".
+
+ NEW content is \"foo\"
+
+ OLD content is \"foo;blub\"
+
+ Policy CMP0019 is not set: Use INTERFACE_LINK_LIBRARIES instead of
+ LINK_INTERFACE_LIBRARIES. Run "cmake --help-policy CMP0019" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn1.cmake b/Tests/RunCMake/PolicyCMP0019/PolicyWarn1.cmake
new file mode 100644
index 0000000..9157fd4
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn1.cmake
@@ -0,0 +1,9 @@
+
+add_library(foo SHARED "libfoo.cpp")
+
+add_library(bar SHARED "libbar.cpp")
+target_link_libraries(bar LINK_INTERFACE_LIBRARIES foo)
+set_property(TARGET bar APPEND PROPERTY LINK_INTERFACE_LIBRARIES blub)
+
+add_executable(testexe "main.cpp")
+target_link_libraries(testexe bar)
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn2-result.txt b/Tests/RunCMake/PolicyCMP0019/PolicyWarn2-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn2-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn2-stderr.txt b/Tests/RunCMake/PolicyCMP0019/PolicyWarn2-stderr.txt
new file mode 100644
index 0000000..6367016
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn2-stderr.txt
@@ -0,0 +1,13 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ The INTERFACE_LINK_LIBRARIES and LINK_INTERFACE_LIBRARIES are not the same
+ for target \"bar\".
+
+ NEW content is \"foo;\$<0:blub>\"
+
+ OLD content is \"foo;blub\"
+
+ Policy CMP0019 is not set: Use INTERFACE_LINK_LIBRARIES instead of
+ LINK_INTERFACE_LIBRARIES. Run "cmake --help-policy CMP0019" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn2.cmake b/Tests/RunCMake/PolicyCMP0019/PolicyWarn2.cmake
new file mode 100644
index 0000000..37fde31
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn2.cmake
@@ -0,0 +1,10 @@
+
+add_library(foo SHARED "libfoo.cpp")
+
+add_library(bar SHARED "libbar.cpp")
+target_link_libraries(bar LINK_INTERFACE_LIBRARIES foo)
+set_property(TARGET bar APPEND PROPERTY LINK_INTERFACE_LIBRARIES blub)
+set_property(TARGET bar APPEND PROPERTY INTERFACE_LINK_LIBRARIES $<0:blub>)
+
+add_executable(testexe "main.cpp")
+target_link_libraries(testexe bar)
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn3-result.txt b/Tests/RunCMake/PolicyCMP0019/PolicyWarn3-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn3-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn3-stderr.txt b/Tests/RunCMake/PolicyCMP0019/PolicyWarn3-stderr.txt
new file mode 100644
index 0000000..4f5c1cb
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn3-stderr.txt
@@ -0,0 +1,13 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+ The INTERFACE_LINK_LIBRARIES and LINK_INTERFACE_LIBRARIES are not the same
+ for target \"bar\".
+
+ NEW content is \"foo;blub\"
+
+ OLD content is \"foo\"
+
+ Policy CMP0019 is not set: Use INTERFACE_LINK_LIBRARIES instead of
+ LINK_INTERFACE_LIBRARIES. Run "cmake --help-policy CMP0019" for policy
+ details. Use the cmake_policy command to set the policy and suppress this
+ warning.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/PolicyCMP0019/PolicyWarn3.cmake b/Tests/RunCMake/PolicyCMP0019/PolicyWarn3.cmake
new file mode 100644
index 0000000..773baf4
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/PolicyWarn3.cmake
@@ -0,0 +1,9 @@
+
+add_library(foo SHARED "libfoo.cpp")
+
+add_library(bar SHARED "libbar.cpp")
+target_link_libraries(bar LINK_INTERFACE_LIBRARIES foo)
+set_property(TARGET bar APPEND PROPERTY INTERFACE_LINK_LIBRARIES blub)
+
+add_executable(testexe "main.cpp")
+target_link_libraries(testexe bar)
diff --git a/Tests/RunCMake/PolicyCMP0019/RunCMakeTest.cmake b/Tests/RunCMake/PolicyCMP0019/RunCMakeTest.cmake
new file mode 100644
index 0000000..2fea3a4
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake(PolicyOld1)
+run_cmake(PolicyOld2)
+run_cmake(PolicyWarn1)
+run_cmake(PolicyWarn2)
+run_cmake(PolicyWarn3)
+run_cmake(PolicyNew1)
diff --git a/Tests/RunCMake/PolicyCMP0019/libbar.cpp b/Tests/RunCMake/PolicyCMP0019/libbar.cpp
new file mode 100644
index 0000000..8331804
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/libbar.cpp
@@ -0,0 +1,2 @@
+
+enum { two };
diff --git a/Tests/RunCMake/PolicyCMP0019/libfoo.cpp b/Tests/RunCMake/PolicyCMP0019/libfoo.cpp
new file mode 100644
index 0000000..08e0dd4
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/libfoo.cpp
@@ -0,0 +1,2 @@
+
+enum { one };
diff --git a/Tests/RunCMake/PolicyCMP0019/main.cpp b/Tests/RunCMake/PolicyCMP0019/main.cpp
new file mode 100644
index 0000000..e9ad257
--- /dev/null
+++ b/Tests/RunCMake/PolicyCMP0019/main.cpp
@@ -0,0 +1,5 @@
+
+int main(int, char**)
+{
+ return 0;
+}
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list