[Cmake-commits] CMake branch, next, updated. v2.8.12.1-5756-gb621013

Stephen Kelly steveire at gmail.com
Mon Nov 25 10:24:23 EST 2013


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  b6210135ed1d2d1d606e8dfcbfa6a5db2736db20 (commit)
       via  5ee9e6bc11a01c7450ffeb14d86f0fe0cef540d6 (commit)
       via  0bfcb450e6cab8d9c2c079e10bf0acea62ffadbe (commit)
      from  004096b0615067057613b65f62e3af6affae3cc3 (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=b6210135ed1d2d1d606e8dfcbfa6a5db2736db20
commit b6210135ed1d2d1d606e8dfcbfa6a5db2736db20
Merge: 004096b 5ee9e6b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 25 10:24:17 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Nov 25 10:24:17 2013 -0500

    Merge topic 'INTERFACE_LIBRARY-property-whitelist' into next
    
    5ee9e6b cmTarget: Add whitelist of properties on INTERFACE_LIBRARY.
    0bfcb45 INTERFACE_LIBRARY: Avoid codepaths which set unneeded properties.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ee9e6bc11a01c7450ffeb14d86f0fe0cef540d6
commit 5ee9e6bc11a01c7450ffeb14d86f0fe0cef540d6
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Nov 25 16:23:11 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 25 16:23:11 2013 +0100

    cmTarget: Add whitelist of properties on INTERFACE_LIBRARY.

diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index 1ccec68..7369fe6 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -428,6 +428,12 @@ struct cmStrCmp {
     return strcmp(input, m_test) == 0;
   }
 
+  // For use with binary_search
+  bool operator()(const char *str1, const char *str2)
+  {
+    return strcmp(str1, str2) < 0;
+  }
+
 private:
   const char *m_test;
 };
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 022048c..b0a8fd1 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1384,12 +1384,63 @@ void cmTarget::GatherDependencies( const cmMakefile& mf,
 }
 
 //----------------------------------------------------------------------------
+static bool whiteListedInterfaceProperty(const char *prop)
+{
+  if(cmHasLiteralPrefix(prop, "INTERFACE_"))
+    {
+    return true;
+    }
+  static const char* builtIns[] = {
+    // ###: This must remain sorted. It is processed with a binary search.
+    "COMPATIBLE_INTERFACE_BOOL",
+    "COMPATIBLE_INTERFACE_NUMBER_MAX",
+    "COMPATIBLE_INTERFACE_NUMBER_MIN",
+    "COMPATIBLE_INTERFACE_STRING",
+    "EXCLUDE_FROM_ALL",
+    "EXCLUDE_FROM_DEFAULT_BUILD",
+    "EXPORT_NAME",
+    "IMPORTED_LINK_INTERFACE_LANGUAGES",
+    "IMPORTED",
+    "NAME",
+    "TYPE",
+    "VERSION"
+  };
+
+  if (std::binary_search(cmArrayBegin(builtIns),
+                         cmArrayEnd(builtIns),
+                         prop,
+                         cmStrCmp(prop)))
+    {
+    return true;
+    }
+
+  if (cmHasLiteralPrefix(prop, "EXCLUDE_FROM_DEFAULT_BUILD_")
+      || cmHasLiteralPrefix(prop, "IMPORTED_LINK_INTERFACE_LANGUAGES_")
+      || cmHasLiteralPrefix(prop, "MAP_IMPORTED_CONFIG_"))
+    {
+    return true;
+    }
+
+  return false;
+}
+
+//----------------------------------------------------------------------------
 void cmTarget::SetProperty(const char* prop, const char* value)
 {
   if (!prop)
     {
     return;
     }
+  if (this->GetType() == INTERFACE_LIBRARY
+      && !whiteListedInterfaceProperty(prop))
+    {
+    cmOStringStream e;
+    e << "INTERFACE_LIBRARY targets may only have whitelisted properties.  "
+         "The property \"" << prop << "\" is not allowed.";
+    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+    return;
+    }
+
   if (strcmp(prop, "NAME") == 0)
     {
     cmOStringStream e;
@@ -1459,6 +1510,15 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
     {
     return;
     }
+  if (this->GetType() == INTERFACE_LIBRARY
+      && !whiteListedInterfaceProperty(prop))
+    {
+    cmOStringStream e;
+    e << "INTERFACE_LIBRARY targets may only have whitelisted properties.  "
+         "The property \"" << prop << "\" is not allowed.";
+    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+    return;
+    }
   if (strcmp(prop, "NAME") == 0)
     {
     cmOStringStream e;
@@ -2574,6 +2634,16 @@ const char *cmTarget::GetProperty(const char* prop,
     return 0;
     }
 
+  if (this->GetType() == INTERFACE_LIBRARY
+      && !whiteListedInterfaceProperty(prop))
+    {
+    cmOStringStream e;
+    e << "INTERFACE_LIBRARY targets may only have whitelisted properties.  "
+         "The property \"" << prop << "\" is not allowed.";
+    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+    return 0;
+    }
+
   if (strcmp(prop, "NAME") == 0)
     {
     return this->GetName();
diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
index 7375888..e257fb3 100644
--- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake
@@ -3,3 +3,4 @@ include(RunCMake)
 run_cmake(invalid_name)
 run_cmake(target_commands)
 run_cmake(no_shared_libs)
+run_cmake(whitelist)
diff --git a/Tests/RunCMake/interface_library/whitelist-result.txt b/Tests/RunCMake/interface_library/whitelist-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/interface_library/whitelist-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/interface_library/whitelist-stderr.txt b/Tests/RunCMake/interface_library/whitelist-stderr.txt
new file mode 100644
index 0000000..577c0cc
--- /dev/null
+++ b/Tests/RunCMake/interface_library/whitelist-stderr.txt
@@ -0,0 +1,19 @@
+CMake Error at whitelist.cmake:4 \(set_property\):
+  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
+  property "OUTPUT_NAME" is not allowed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
+
+
+CMake Error at whitelist.cmake:5 \(set_property\):
+  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
+  property "OUTPUT_NAME" is not allowed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
+
+
+CMake Error at whitelist.cmake:6 \(get_target_property\):
+  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
+  property "OUTPUT_NAME" is not allowed.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/interface_library/whitelist.cmake b/Tests/RunCMake/interface_library/whitelist.cmake
new file mode 100644
index 0000000..98ef05c
--- /dev/null
+++ b/Tests/RunCMake/interface_library/whitelist.cmake
@@ -0,0 +1,6 @@
+
+add_library(iface INTERFACE)
+
+set_property(TARGET iface PROPERTY OUTPUT_NAME output)
+set_property(TARGET iface APPEND PROPERTY OUTPUT_NAME append)
+get_target_property(outname iface OUTPUT_NAME)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0bfcb450e6cab8d9c2c079e10bf0acea62ffadbe
commit 0bfcb450e6cab8d9c2c079e10bf0acea62ffadbe
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Nov 20 12:44:04 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Nov 25 16:17:50 2013 +0100

    INTERFACE_LIBRARY: Avoid codepaths which set unneeded properties.
    
    As an INTERFACE_LIBRARY has no direct link dependencies, we can
    short-circuit in cmGeneratorExpressionEvaluator and
    in cmGlobalGenerator::CheckLocalGenerators.
    
    As they do not generate any output directly, any generate- or install-
    related code acn also be short-circuited. Many of the local generators
    already do this.
    
    Because only INTERFACE related properties make sense on INTERFACE_LIBRARY
    targets, avoid setting other properties, for example via defaults.

diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 7fd4754..cb9e37e 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -237,7 +237,15 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
     it != configs.end(); ++it)
     {
     std::vector<std::string> tlibs;
-    depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender);
+    if (depender->GetType() == cmTarget::INTERFACE_LIBRARY)
+      {
+      // For INTERFACE_LIBRARY depend on the interface instead.
+      depender->GetInterfaceLinkLibraries(it->c_str(), tlibs, depender);
+      }
+    else
+      {
+      depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender);
+      }
     // A target should not depend on itself.
     emitted.insert(depender->GetName());
     for(std::vector<std::string>::const_iterator lib = tlibs.begin();
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 2ce4458..dc62284 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -388,14 +388,11 @@ void getCompatibleInterfaceProperties(cmTarget *target,
 
   if (!info)
     {
-    if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
-      {
-      cmMakefile* mf = target->GetMakefile();
-      cmOStringStream e;
-      e << "Exporting the target \"" << target->GetName() << "\" is not "
-          "allowed since its linker language cannot be determined";
-      mf->IssueMessage(cmake::FATAL_ERROR, e.str());
-      }
+    cmMakefile* mf = target->GetMakefile();
+    cmOStringStream e;
+    e << "Exporting the target \"" << target->GetName() << "\" is not "
+        "allowed since its linker language cannot be determined";
+    mf->IssueMessage(cmake::FATAL_ERROR, e.str());
     return;
     }
 
@@ -447,15 +444,18 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
   getPropertyContents(target, "COMPATIBLE_INTERFACE_NUMBER_MAX",
                       ifaceProperties);
 
-  getCompatibleInterfaceProperties(target, ifaceProperties, 0);
+  if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
+    {
+    getCompatibleInterfaceProperties(target, ifaceProperties, 0);
 
-  std::vector<std::string> configNames;
-  target->GetMakefile()->GetConfigurations(configNames);
+    std::vector<std::string> configNames;
+    target->GetMakefile()->GetConfigurations(configNames);
 
-  for (std::vector<std::string>::const_iterator ci = configNames.begin();
-    ci != configNames.end(); ++ci)
-    {
-    getCompatibleInterfaceProperties(target, ifaceProperties, ci->c_str());
+    for (std::vector<std::string>::const_iterator ci = configNames.begin();
+      ci != configNames.end(); ++ci)
+      {
+      getCompatibleInterfaceProperties(target, ifaceProperties, ci->c_str());
+      }
     }
 
   for (std::set<std::string>::const_iterator it = ifaceProperties.begin();
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 67972b9..17bf041 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -954,7 +954,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
 
     if (!prop)
       {
-      if (target->IsImported())
+      if (target->IsImported()
+          || target->GetType() == cmTarget::INTERFACE_LIBRARY)
         {
         return linkedTargetsContent;
         }
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 20cd15e..e6f3d94 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1309,6 +1309,11 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
       {
       cmTarget* t = &ti->second;
 
+      if (t->GetType() == cmTarget::INTERFACE_LIBRARY)
+        {
+        continue;
+        }
+
       t->AppendBuildInterfaceIncludes();
 
       for (std::vector<cmValueWithOrigin>::const_iterator it
@@ -1461,6 +1466,10 @@ void cmGlobalGenerator::CheckLocalGenerators()
     for (cmTargets::iterator l = targets.begin();
          l != targets.end(); l++)
       {
+      if (l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+        {
+        continue;
+        }
       const cmTarget::LinkLibraryVectorType& libs =
         l->second.GetOriginalLinkLibraries();
       for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin();
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 3d939f3..f523a8f 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -327,6 +327,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
         projectTargets.begin(); tt != projectTargets.end(); ++tt)
     {
     cmTarget* target = *tt;
+    if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
+      {
+      continue;
+      }
     const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
     if(expath)
       {
@@ -364,6 +368,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
         projectTargets.begin(); tt != projectTargets.end(); ++tt)
     {
     cmTarget* target = *tt;
+    if(target->GetType() == cmTarget::INTERFACE_LIBRARY)
+      {
+      continue;
+      }
     bool written = false;
 
     // handle external vc project files
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 69b0a7a..e4ce13f 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -442,7 +442,8 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
     {
     if(cmTarget* depTarget = this->FindTarget(0, ui->c_str()))
       {
-      if(depTarget->GetProperty("EXTERNAL_MSPROJECT"))
+      if(depTarget->GetType() != cmTarget::INTERFACE_LIBRARY
+          && depTarget->GetProperty("EXTERNAL_MSPROJECT"))
         {
         // This utility dependency names an external .vcproj target.
         // We use LinkLibraryDependencies="true" to link to it without
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index d309a2a..10578f2 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -645,7 +645,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
     // generators for them.
     bool createInstallGeneratorsForTargetFileSets = true;
 
-    if(target.IsFrameworkOnApple())
+    if(target.IsFrameworkOnApple()
+        || target.GetType() == cmTarget::INTERFACE_LIBRARY)
       {
       createInstallGeneratorsForTargetFileSets = false;
       }
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index cf5798f..d26d6e9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -541,6 +541,10 @@ void cmLocalGenerator::GenerateTargetManifest()
       t != targets.end(); ++t)
     {
     cmGeneratorTarget& target = *t->second;
+    if (target.Target->GetType() == cmTarget::INTERFACE_LIBRARY)
+      {
+      continue;
+      }
     if(configNames.empty())
       {
       target.GenerateTargetManifest(0);
@@ -2829,6 +2833,11 @@ cmLocalGenerator
   cmTargets& tgts = this->Makefile->GetTargets();
   for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
     {
+    if (l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+      {
+      continue;
+      }
+
     // Include the user-specified pre-install script for this target.
     if(const char* preinstall = l->second.GetProperty("PRE_INSTALL_SCRIPT"))
       {
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 158d714..168bc42 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -68,7 +68,8 @@ void cmLocalNinjaGenerator::Generate()
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
     {
-    if (t->second->Target->IsImported())
+    if (t->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+        || t->second->Target->IsImported())
       {
       continue;
       }
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 9af5c29..5ada88d 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -151,7 +151,8 @@ void cmLocalUnixMakefileGenerator3::Generate()
   for(cmGeneratorTargetsType::iterator t = targets.begin();
       t != targets.end(); ++t)
     {
-    if (t->second->Target->IsImported())
+    if (t->second->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+        || t->second->Target->IsImported())
       {
       continue;
       }
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 989aa5f..30a1557 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -868,6 +868,10 @@ void cmMakefile::ConfigureFinalPass()
   for (cmTargets::iterator l = this->Targets.begin();
        l != this->Targets.end(); l++)
     {
+    if (l->second.GetType() == cmTarget::INTERFACE_LIBRARY)
+      {
+      continue;
+      }
     l->second.FinishConfigure();
     }
 }
@@ -2256,6 +2260,10 @@ void cmMakefile::ExpandVariablesCMP0019()
        l != this->Targets.end(); ++l)
     {
     cmTarget &t = l->second;
+    if (t.GetType() == cmTarget::INTERFACE_LIBRARY)
+      {
+      continue;
+      }
     includeDirs = t.GetProperty("INCLUDE_DIRECTORIES");
     if(mightExpandVariablesCMP0019(includeDirs))
       {
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 7b8a531..35818ee 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -25,9 +25,12 @@ cmMakefileLibraryTargetGenerator
   cmMakefileTargetGenerator(target->Target)
 {
   this->CustomCommandDriver = OnDepends;
-  this->Target->GetLibraryNames(
-    this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
-    this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
+  if (this->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
+    {
+    this->Target->GetLibraryNames(
+      this->TargetNameOut, this->TargetNameSO, this->TargetNameReal,
+      this->TargetNameImport, this->TargetNamePDB, this->ConfigName);
+    }
 
   this->OSXBundleGenerator = new cmOSXBundleGenerator(target,
                                                       this->ConfigName);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 120a666..022048c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -255,32 +255,34 @@ void cmTarget::SetMakefile(cmMakefile* mf)
   this->IsApple = this->Makefile->IsOn("APPLE");
 
   // Setup default property values.
-  this->SetPropertyDefault("INSTALL_NAME_DIR", 0);
-  this->SetPropertyDefault("INSTALL_RPATH", "");
-  this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");
-  this->SetPropertyDefault("SKIP_BUILD_RPATH", "OFF");
-  this->SetPropertyDefault("BUILD_WITH_INSTALL_RPATH", "OFF");
-  this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", 0);
-  this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0);
-  this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
-  this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", 0);
-  this->SetPropertyDefault("Fortran_FORMAT", 0);
-  this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
-  this->SetPropertyDefault("GNUtoMS", 0);
-  this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
-  this->SetPropertyDefault("AUTOMOC", 0);
-  this->SetPropertyDefault("AUTOUIC", 0);
-  this->SetPropertyDefault("AUTORCC", 0);
-  this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
-  this->SetPropertyDefault("AUTOUIC_OPTIONS", 0);
-  this->SetPropertyDefault("AUTORCC_OPTIONS", 0);
-  this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", 0);
-  this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);
-  this->SetPropertyDefault("WIN32_EXECUTABLE", 0);
-  this->SetPropertyDefault("MACOSX_BUNDLE", 0);
-  this->SetPropertyDefault("MACOSX_RPATH", 0);
-  this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
-
+  if (this->GetType() != INTERFACE_LIBRARY)
+    {
+    this->SetPropertyDefault("INSTALL_NAME_DIR", 0);
+    this->SetPropertyDefault("INSTALL_RPATH", "");
+    this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");
+    this->SetPropertyDefault("SKIP_BUILD_RPATH", "OFF");
+    this->SetPropertyDefault("BUILD_WITH_INSTALL_RPATH", "OFF");
+    this->SetPropertyDefault("ARCHIVE_OUTPUT_DIRECTORY", 0);
+    this->SetPropertyDefault("LIBRARY_OUTPUT_DIRECTORY", 0);
+    this->SetPropertyDefault("RUNTIME_OUTPUT_DIRECTORY", 0);
+    this->SetPropertyDefault("PDB_OUTPUT_DIRECTORY", 0);
+    this->SetPropertyDefault("Fortran_FORMAT", 0);
+    this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0);
+    this->SetPropertyDefault("GNUtoMS", 0);
+    this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
+    this->SetPropertyDefault("AUTOMOC", 0);
+    this->SetPropertyDefault("AUTOUIC", 0);
+    this->SetPropertyDefault("AUTORCC", 0);
+    this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
+    this->SetPropertyDefault("AUTOUIC_OPTIONS", 0);
+    this->SetPropertyDefault("AUTORCC_OPTIONS", 0);
+    this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", 0);
+    this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);
+    this->SetPropertyDefault("WIN32_EXECUTABLE", 0);
+    this->SetPropertyDefault("MACOSX_BUNDLE", 0);
+    this->SetPropertyDefault("MACOSX_RPATH", 0);
+    this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
+    }
 
   // Collect the set of configuration types.
   std::vector<std::string> configNames;
@@ -300,6 +302,11 @@ void cmTarget::SetMakefile(cmMakefile* mf)
     std::string configUpper = cmSystemTools::UpperCase(*ci);
     for(const char** p = configProps; *p; ++p)
       {
+      if (this->TargetTypeValue == INTERFACE_LIBRARY
+          && strcmp(*p, "MAP_IMPORTED_CONFIG_") != 0)
+        {
+        continue;
+        }
       std::string property = *p;
       property += configUpper;
       this->SetPropertyDefault(property.c_str(), 0);
@@ -311,7 +318,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
     // did not support this variable.  Projects may still specify the
     // property directly.  TODO: Make this depend on backwards
     // compatibility setting.
-    if(this->TargetTypeValue != cmTarget::EXECUTABLE)
+    if(this->TargetTypeValue != cmTarget::EXECUTABLE
+        && this->TargetTypeValue != cmTarget::INTERFACE_LIBRARY)
       {
       std::string property = cmSystemTools::UpperCase(*ci);
       property += "_POSTFIX";
@@ -352,16 +360,22 @@ void cmTarget::SetMakefile(cmMakefile* mf)
     this->InsertCompileOption(*it);
     }
 
-  this->SetPropertyDefault("C_VISIBILITY_PRESET", 0);
-  this->SetPropertyDefault("CXX_VISIBILITY_PRESET", 0);
-  this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", 0);
+  if (this->GetType() != INTERFACE_LIBRARY)
+    {
+    this->SetPropertyDefault("C_VISIBILITY_PRESET", 0);
+    this->SetPropertyDefault("CXX_VISIBILITY_PRESET", 0);
+    this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", 0);
+    }
 
   if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY
       || this->TargetTypeValue == cmTarget::MODULE_LIBRARY)
     {
     this->SetProperty("POSITION_INDEPENDENT_CODE", "True");
     }
-  this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0);
+  if (this->GetType() != INTERFACE_LIBRARY)
+    {
+    this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0);
+    }
 
   // Record current policies for later use.
 #define CAPTURE_TARGET_POLICY(POLICY) \
@@ -4433,7 +4447,8 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
 bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
                                            const char *config) const
 {
-  if (this->TargetTypeValue == OBJECT_LIBRARY)
+  if (this->TargetTypeValue == OBJECT_LIBRARY
+      || this->TargetTypeValue == INTERFACE_LIBRARY)
     {
     return false;
     }
@@ -4446,7 +4461,8 @@ bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
 bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
                                     const char *config) const
 {
-  if (this->TargetTypeValue == OBJECT_LIBRARY)
+  if (this->TargetTypeValue == OBJECT_LIBRARY
+      || this->TargetTypeValue == INTERFACE_LIBRARY)
     {
     return false;
     }
@@ -4458,7 +4474,8 @@ bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
 bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
                                     const char *config) const
 {
-  if (this->TargetTypeValue == OBJECT_LIBRARY)
+  if (this->TargetTypeValue == OBJECT_LIBRARY
+      || this->TargetTypeValue == INTERFACE_LIBRARY)
     {
     return false;
     }
@@ -4470,7 +4487,8 @@ bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
 bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
                                     const char *config) const
 {
-  if (this->TargetTypeValue == OBJECT_LIBRARY)
+  if (this->TargetTypeValue == OBJECT_LIBRARY
+      || this->TargetTypeValue == INTERFACE_LIBRARY)
     {
     return false;
     }
@@ -5105,34 +5123,37 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
         {
         emitted.insert(*li);
         }
-      LinkImplementation const* impl = this->GetLinkImplementation(config,
-                                                                headTarget);
-      for(std::vector<std::string>::const_iterator
-            li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
+      if (this->GetType() != cmTarget::INTERFACE_LIBRARY)
         {
-        if(emitted.insert(*li).second)
+        LinkImplementation const* impl = this->GetLinkImplementation(config,
+                                                                  headTarget);
+        for(std::vector<std::string>::const_iterator
+              li = impl->Libraries.begin(); li != impl->Libraries.end(); ++li)
           {
-          if(cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str()))
+          if(emitted.insert(*li).second)
             {
-            // This is a runtime dependency on another shared library.
-            if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
+            if(cmTarget* tgt = this->Makefile->FindTargetToUse(li->c_str()))
               {
-              iface.SharedDeps.push_back(*li);
+              // This is a runtime dependency on another shared library.
+              if(tgt->GetType() == cmTarget::SHARED_LIBRARY)
+                {
+                iface.SharedDeps.push_back(*li);
+                }
+              }
+            else
+              {
+              // TODO: Recognize shared library file names.  Perhaps this
+              // should be moved to cmComputeLinkInformation, but that creates
+              // a chicken-and-egg problem since this list is needed for its
+              // construction.
               }
-            }
-          else
-            {
-            // TODO: Recognize shared library file names.  Perhaps this
-            // should be moved to cmComputeLinkInformation, but that creates
-            // a chicken-and-egg problem since this list is needed for its
-            // construction.
             }
           }
-        }
-      if(this->LinkLanguagePropagatesToDependents())
-        {
-        // Targets using this archive need its language runtime libraries.
-        iface.Languages = impl->Languages;
+        if(this->LinkLanguagePropagatesToDependents())
+          {
+          // Targets using this archive need its language runtime libraries.
+          iface.Languages = impl->Languages;
+          }
         }
       }
     }
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 635d8cb..10663b7 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -184,7 +184,8 @@ void cmVisualStudio10TargetGenerator::WriteString(const char* line,
 void cmVisualStudio10TargetGenerator::Generate()
 {
   // do not generate external ms projects
-  if(this->Target->GetProperty("EXTERNAL_MSPROJECT"))
+  if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY
+      || this->Target->GetProperty("EXTERNAL_MSPROJECT"))
     {
     return;
     }

-----------------------------------------------------------------------

Summary of changes:
 Source/cmComputeTargetDepends.cxx                  |   10 +-
 Source/cmExportFileGenerator.cxx                   |   30 ++--
 Source/cmGeneratorExpressionEvaluator.cxx          |    3 +-
 Source/cmGlobalGenerator.cxx                       |    9 +
 Source/cmGlobalVisualStudio7Generator.cxx          |    8 +
 Source/cmGlobalVisualStudio8Generator.cxx          |    3 +-
 Source/cmInstallCommand.cxx                        |    3 +-
 Source/cmLocalGenerator.cxx                        |    9 +
 Source/cmLocalNinjaGenerator.cxx                   |    3 +-
 Source/cmLocalUnixMakefileGenerator3.cxx           |    3 +-
 Source/cmMakefile.cxx                              |    8 +
 Source/cmMakefileLibraryTargetGenerator.cxx        |    9 +-
 Source/cmStandardIncludes.h                        |    6 +
 Source/cmTarget.cxx                                |  203 ++++++++++++++------
 Source/cmVisualStudio10TargetGenerator.cxx         |    3 +-
 .../RunCMake/interface_library/RunCMakeTest.cmake  |    1 +
 .../whitelist-result.txt}                          |    0
 .../interface_library/whitelist-stderr.txt         |   19 ++
 Tests/RunCMake/interface_library/whitelist.cmake   |    6 +
 19 files changed, 255 insertions(+), 81 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => interface_library/whitelist-result.txt} (100%)
 create mode 100644 Tests/RunCMake/interface_library/whitelist-stderr.txt
 create mode 100644 Tests/RunCMake/interface_library/whitelist.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list