[Cmake-commits] CMake branch, next, updated. v2.8.12.2-7548-g0f88045

Stephen Kelly steveire at gmail.com
Sun Feb 9 09:37:21 EST 2014


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  0f88045a7dc2804d3b050b9b49ccf7bb2bc9ae84 (commit)
       via  b29152387dc8b95895beb98d8f03d2b1c9532ed9 (commit)
      from  677bbe893742102be60888c3bcd0bf50cc2544d8 (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=0f88045a7dc2804d3b050b9b49ccf7bb2bc9ae84
commit 0f88045a7dc2804d3b050b9b49ccf7bb2bc9ae84
Merge: 677bbe8 b291523
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Feb 9 09:37:19 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Feb 9 09:37:19 2014 -0500

    Merge topic 'fix-CMP0028-iface' into next
    
    b2915238 CMP0028: Trigger on libraries from INTERFACE of dependencies.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b29152387dc8b95895beb98d8f03d2b1c9532ed9
commit b29152387dc8b95895beb98d8f03d2b1c9532ed9
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Feb 9 15:35:28 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Feb 9 15:35:28 2014 +0100

    CMP0028: Trigger on libraries from INTERFACE of dependencies.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index e51095e..18ba7c8 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2832,12 +2832,54 @@ public:
   cmTargetCollectLinkLanguages(cmTarget const* target, const char* config,
                                std::set<cmStdString>& languages,
                                cmTarget const* head):
-    Config(config), Languages(languages), HeadTarget(head)
+    Config(config), Languages(languages), HeadTarget(head),
+    Makefile(target->GetMakefile()), Target(target)
   { this->Visited.insert(target); }
 
-  void Visit(cmTarget const* target)
+  void Visit(const std::string& name)
     {
-    if(!target || !this->Visited.insert(target).second)
+    cmTarget *target = this->Makefile->FindTargetToUse(name);
+
+    if(!target)
+      {
+      if(name.find("::") != std::string::npos)
+        {
+        bool noMessage = false;
+        cmake::MessageType messageType = cmake::FATAL_ERROR;
+        cmOStringStream e;
+        switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028))
+          {
+          case cmPolicies::WARN:
+            {
+            e << (this->Makefile->GetPolicies()
+                  ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n";
+            messageType = cmake::AUTHOR_WARNING;
+            }
+            break;
+          case cmPolicies::OLD:
+            noMessage = true;
+          case cmPolicies::REQUIRED_IF_USED:
+          case cmPolicies::REQUIRED_ALWAYS:
+          case cmPolicies::NEW:
+            // Issue the fatal message.
+            break;
+          }
+
+        if(!noMessage)
+          {
+          e << "Target \"" << this->Target->GetName()
+            << "\" links to target \"" << name
+            << "\" but the target was not found.  Perhaps a find_package() "
+            "call is missing for an IMPORTED target, or an ALIAS target is "
+            "missing?";
+          this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
+                                                e.str(),
+                                                this->Target->GetBacktrace());
+          }
+        }
+      return;
+      }
+    if(!this->Visited.insert(target).second)
       {
       return;
       }
@@ -2852,17 +2894,18 @@ public:
       this->Languages.insert(*li);
       }
 
-    cmMakefile* mf = target->GetMakefile();
     for(std::vector<std::string>::const_iterator
           li = iface->Libraries.begin(); li != iface->Libraries.end(); ++li)
       {
-      this->Visit(mf->FindTargetToUse(*li));
+      this->Visit(*li);
       }
     }
 private:
   const char* Config;
   std::set<cmStdString>& Languages;
   cmTarget const* HeadTarget;
+  cmMakefile* Makefile;
+  const cmTarget* Target;
   std::set<cmTarget const*> Visited;
 };
 
@@ -2964,7 +3007,7 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
   for(std::vector<std::string>::const_iterator li = impl->Libraries.begin();
       li != impl->Libraries.end(); ++li)
     {
-    cll.Visit(this->Makefile->FindTargetToUse(*li));
+    cll.Visit(*li);
     }
 
   // Store the transitive closure of languages.
@@ -5619,46 +5662,6 @@ void cmTarget::ComputeLinkImplementation(const char* config,
         }
       continue;
       }
-    cmTarget *tgt = this->Makefile->FindTargetToUse(*li);
-
-    if(!tgt && std::string(item).find("::") != std::string::npos)
-      {
-      bool noMessage = false;
-      cmake::MessageType messageType = cmake::FATAL_ERROR;
-      cmOStringStream e;
-      switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0028))
-        {
-        case cmPolicies::WARN:
-          {
-          e << (this->Makefile->GetPolicies()
-                ->GetPolicyWarning(cmPolicies::CMP0028)) << "\n";
-          messageType = cmake::AUTHOR_WARNING;
-          }
-          break;
-        case cmPolicies::OLD:
-          noMessage = true;
-        case cmPolicies::REQUIRED_IF_USED:
-        case cmPolicies::REQUIRED_ALWAYS:
-        case cmPolicies::NEW:
-          // Issue the fatal message.
-          break;
-        }
-
-      if(!noMessage)
-        {
-        e << "Target \"" << this->GetName() << "\" links to target \"" << item
-          << "\" but the target was not found.  Perhaps a find_package() "
-          "call is missing for an IMPORTED target, or an ALIAS target is "
-          "missing?";
-        this->Makefile->GetCMakeInstance()->IssueMessage(messageType,
-                                                      e.str(),
-                                                      this->GetBacktrace());
-        if (messageType == cmake::FATAL_ERROR)
-          {
-          return;
-          }
-        }
-      }
 
     // The entry is meant for this configuration.
     impl.Libraries.push_back(item);
diff --git a/Tests/RunCMake/CMP0028/CMP0028-NEW-iface-result.txt b/Tests/RunCMake/CMP0028/CMP0028-NEW-iface-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-NEW-iface-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0028/CMP0028-NEW-iface-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-NEW-iface-stderr.txt
new file mode 100644
index 0000000..e2108f4
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-NEW-iface-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at CMP0028-NEW-iface.cmake:6 \(add_library\):
+  Target "foo" links to target "External::Library" but the target was not
+  found.  Perhaps a find_package\(\) call is missing for an IMPORTED target, or
+  an ALIAS target is missing\?
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0028/CMP0028-NEW-iface.cmake b/Tests/RunCMake/CMP0028/CMP0028-NEW-iface.cmake
new file mode 100644
index 0000000..1a71433
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-NEW-iface.cmake
@@ -0,0 +1,7 @@
+
+cmake_policy(SET CMP0028 NEW)
+
+add_library(iface INTERFACE)
+target_link_libraries(iface INTERFACE External::Library)
+add_library(foo empty.cpp)
+target_link_libraries(foo iface)
diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-result.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0028/CMP0028-OLD-iface.cmake b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface.cmake
new file mode 100644
index 0000000..d7bd60e
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-OLD-iface.cmake
@@ -0,0 +1,7 @@
+
+cmake_policy(SET CMP0028 OLD)
+
+add_library(iface INTERFACE)
+target_link_libraries(iface INTERFACE External::Library)
+add_library(foo empty.cpp)
+target_link_libraries(foo iface)
diff --git a/Tests/RunCMake/CMP0028/CMP0028-WARN-iface-result.txt b/Tests/RunCMake/CMP0028/CMP0028-WARN-iface-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-WARN-iface-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0028/CMP0028-WARN-iface-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-WARN-iface-stderr.txt
new file mode 100644
index 0000000..0c5c653
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-WARN-iface-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at CMP0028-WARN-iface.cmake:4 \(add_library\):
+  Policy CMP0028 is not set: Double colon in target name means ALIAS or
+  IMPORTED target.  Run "cmake --help-policy CMP0028" for policy details.
+  Use the cmake_policy command to set the policy and suppress this warning.
+
+  Target "foo" links to target "External::Library" but the target was not
+  found.  Perhaps a find_package\(\) call is missing for an IMPORTED target, or
+  an ALIAS target is missing\?
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CMP0028/CMP0028-WARN-iface.cmake b/Tests/RunCMake/CMP0028/CMP0028-WARN-iface.cmake
new file mode 100644
index 0000000..9270023
--- /dev/null
+++ b/Tests/RunCMake/CMP0028/CMP0028-WARN-iface.cmake
@@ -0,0 +1,5 @@
+
+add_library(iface INTERFACE)
+target_link_libraries(iface INTERFACE External::Library)
+add_library(foo empty.cpp)
+target_link_libraries(foo iface)
diff --git a/Tests/RunCMake/CMP0028/RunCMakeTest.cmake b/Tests/RunCMake/CMP0028/RunCMakeTest.cmake
index 293e27b..0c72ca2 100644
--- a/Tests/RunCMake/CMP0028/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0028/RunCMakeTest.cmake
@@ -3,3 +3,6 @@ include(RunCMake)
 run_cmake(CMP0028-NEW)
 run_cmake(CMP0028-OLD)
 run_cmake(CMP0028-WARN)
+run_cmake(CMP0028-NEW-iface)
+run_cmake(CMP0028-OLD-iface)
+run_cmake(CMP0028-WARN-iface)

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

Summary of changes:
 Source/cmTarget.cxx                                |   95 ++++++++++----------
 .../CMP0028-NEW-iface-result.txt}                  |    0
 ...NEW-stderr.txt => CMP0028-NEW-iface-stderr.txt} |    2 +-
 Tests/RunCMake/CMP0028/CMP0028-NEW-iface.cmake     |    7 ++
 .../CMP0028-OLD-iface-result.txt}                  |    0
 .../CMP0028-OLD-iface-stderr.txt}                  |    0
 Tests/RunCMake/CMP0028/CMP0028-OLD-iface.cmake     |    7 ++
 .../CMP0028-WARN-iface-result.txt}                 |    0
 ...RN-stderr.txt => CMP0028-WARN-iface-stderr.txt} |    2 +-
 Tests/RunCMake/CMP0028/CMP0028-WARN-iface.cmake    |    5 ++
 Tests/RunCMake/CMP0028/RunCMakeTest.cmake          |    3 +
 11 files changed, 73 insertions(+), 48 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CMP0028/CMP0028-NEW-iface-result.txt} (100%)
 copy Tests/RunCMake/CMP0028/{CMP0028-NEW-stderr.txt => CMP0028-NEW-iface-stderr.txt} (81%)
 create mode 100644 Tests/RunCMake/CMP0028/CMP0028-NEW-iface.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => CMP0028/CMP0028-OLD-iface-result.txt} (100%)
 copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-exe-stderr.txt => CMP0028/CMP0028-OLD-iface-stderr.txt} (100%)
 create mode 100644 Tests/RunCMake/CMP0028/CMP0028-OLD-iface.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => CMP0028/CMP0028-WARN-iface-result.txt} (100%)
 copy Tests/RunCMake/CMP0028/{CMP0028-WARN-stderr.txt => CMP0028-WARN-iface-stderr.txt} (88%)
 create mode 100644 Tests/RunCMake/CMP0028/CMP0028-WARN-iface.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list