[Cmake-commits] CMake branch, next, updated. v2.8.2-582-g5bcc13a

Alexander Neundorf neundorf at kde.org
Sat Aug 28 10:11:27 EDT 2010


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  5bcc13a4e9634da29d1584ab3fd678a027187c44 (commit)
       via  6acc71c09df80e9530ff643fb4e37ebe145b46ad (commit)
       via  da033b10d26c3b25c44547dec6b398cabe864510 (commit)
      from  93d87a7f26c3773fd2ddff6ea12a8e1551585659 (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=5bcc13a4e9634da29d1584ab3fd678a027187c44
commit 5bcc13a4e9634da29d1584ab3fd678a027187c44
Merge: 93d87a7 6acc71c
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Sat Aug 28 16:09:57 2010 +0200
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Sat Aug 28 16:09:57 2010 +0200

    Merge branch 'MakeTargetLinkLibrariesComplainWhenNoTargetIsUsed' into next


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6acc71c09df80e9530ff643fb4e37ebe145b46ad
commit 6acc71c09df80e9530ff643fb4e37ebe145b46ad
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Sat Aug 28 16:06:45 2010 +0200
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Sat Aug 28 16:06:45 2010 +0200

    New CMP0016 for deciding whether an unknown target in TLL() is an error.
    
    When set to OLD, target_link_libraries() silently accepts if it is called
    with only one argument and this one argument is not a target.
    When set to NEW, this is an error. By default it is a warning now.
    
    Alex

diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index fb84738..3fe92de 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -438,6 +438,14 @@ cmPolicies::cmPolicies()
     "CMAKE_CURRENT_SOURCE_DIR.",
     2,8,1,0, cmPolicies::WARN);
 
+    this->DefinePolicy(
+    CMP0016, "CMP0016",
+    "target_link_libraries() reports error if only argument is not a target.",
+    "In CMake 2.8.2 and lower the target_link_libraries() command silently "
+    "ignored if it was called with only one argument, and this argument "
+    "wasn't a valid target. "
+    "In CMake 2.8.3 and above it reports an error in this case.",
+    2,8,3,0, cmPolicies::WARN);
 }
 
 cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index eb714c1..fce33ac 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -51,6 +51,7 @@ public:
     CMP0013, // Duplicate binary directories not allowed
     CMP0014, // Input directories must have CMakeLists.txt
     CMP0015, // link_directories() treats paths relative to source dir
+    CMP0016, // target_link_libraries() fails if only argument is not a target
 
     // Always the last entry.  Useful mostly to avoid adding a comma
     // the last policy when adding a new one.
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index e92a8fa..805959d 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -35,20 +35,51 @@ bool cmTargetLinkLibrariesCommand
     ->GetGlobalGenerator()->FindTarget(0, args[0].c_str());
   if(!this->Target)
     {
+    cmake::MessageType t = cmake::FATAL_ERROR;  // fail by default
     cmOStringStream e;
     e << "Cannot specify link libraries for target \"" << args[0] << "\" "
       << "which is not built by this project.";
-    // The bad target is the only argument, just warn, don't fail, because
-    // there is probably some code out there which would stop building
-    // otherwise:
+    // The bad target is the only argument. Check how policy CMP0016 is set,
+    // and accept, warn or fail respectively:
     if (args.size() < 2)
       {
-      this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+      switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0016))
+        {
+        case cmPolicies::WARN:
+          t = cmake::AUTHOR_WARNING;
+          // Print the warning.
+          e << "\n"
+            << "CMake does not support this but it used to work accidentally "
+            << "and is being allowed for compatibility."
+            << "\n" << this->Makefile->GetPolicies()->
+                                        GetPolicyWarning(cmPolicies::CMP0016);
+           break;
+        case cmPolicies::OLD:          // OLD behavior does not warn.
+          t = cmake::MESSAGE;
+          break;
+        case cmPolicies::REQUIRED_IF_USED:
+        case cmPolicies::REQUIRED_ALWAYS:
+          e << "\n" << this->Makefile->GetPolicies()->
+                                  GetRequiredPolicyError(cmPolicies::CMP0016);
+          break;
+        case cmPolicies::NEW:  // NEW behavior prints the error.
+        default:
+          break;
+        }
       }
-    else
+
+    // now actually print the message
+    switch(t)
       {
-      this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
-      cmSystemTools::SetFatalErrorOccured();
+      case cmake::AUTHOR_WARNING:
+        this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+        break;
+      case cmake::FATAL_ERROR:
+        this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+        cmSystemTools::SetFatalErrorOccured();
+        break;
+      default:
+        break;
       }
     return true;
     }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=da033b10d26c3b25c44547dec6b398cabe864510
commit da033b10d26c3b25c44547dec6b398cabe864510
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Sat Aug 28 16:01:49 2010 +0200
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Sat Aug 28 16:01:49 2010 +0200

    Remove trailing whitespace
    
    Alex

diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 69d3e51..fb84738 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -15,8 +15,8 @@ const char* cmPolicies::PolicyStatusNames[] = {
 
 class cmPolicy
 {
-public:  
-  cmPolicy(cmPolicies::PolicyID iD, 
+public:
+  cmPolicy(cmPolicies::PolicyID iD,
             const char *idString,
             const char *shortDescription,
             const char *longDescription,
@@ -55,7 +55,7 @@ public:
     return v.str();
   }
 
-  bool IsPolicyNewerThan(unsigned int majorV, 
+  bool IsPolicyNewerThan(unsigned int majorV,
                          unsigned int minorV,
                          unsigned int patchV,
                          unsigned int tweakV)
@@ -86,7 +86,7 @@ public:
     }
     return (tweakV < this->TweakVersionIntroduced);
   }
-  
+
   cmPolicies::PolicyID ID;
   std::string IDString;
   std::string ShortDescription;
@@ -285,12 +285,12 @@ cmPolicies::cmPolicies()
     "The NEW behavior for this policy is to produce an error if a bundle "
     "target is installed without a BUNDLE DESTINATION.",
     2,6,0,0, cmPolicies::WARN);
-  
+
   this->DefinePolicy(
     CMP0007, "CMP0007",
     "list command no longer ignores empty elements.",
     "This policy determines whether the list command will "
-    "ignore empty elements in the list. " 
+    "ignore empty elements in the list. "
     "CMake 2.4 and below list commands ignored all empty elements"
     " in the list.  For example, a;b;;c would have length 3 and not 4. "
     "The OLD behavior for this policy is to ignore empty list elements. "
@@ -426,7 +426,7 @@ cmPolicies::cmPolicies()
     this->DefinePolicy(
     CMP0015, "CMP0015",
     "link_directories() treats paths relative to the source dir.",
-    "In CMake 2.6.4 and lower the link_directories() command passed relative "
+    "In CMake 2.8.0 and lower the link_directories() command passed relative "
     "paths unchanged to the linker.  "
     "In CMake 2.8.1 and above the link_directories() command prefers to "
     "interpret relative paths with respect to CMAKE_CURRENT_SOURCE_DIR, "
@@ -437,12 +437,13 @@ cmPolicies::cmPolicies()
     "absolute paths by appending the relative path to "
     "CMAKE_CURRENT_SOURCE_DIR.",
     2,8,1,0, cmPolicies::WARN);
+
 }
 
 cmPolicies::~cmPolicies()
 {
   // free the policies
-  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i 
+  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
     = this->Policies.begin();
   for (;i != this->Policies.end(); ++i)
   {
@@ -451,7 +452,7 @@ cmPolicies::~cmPolicies()
 }
 
 void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
-                              const char *idString, 
+                              const char *idString,
                               const char *shortDescription,
                               const char *longDescription,
                               unsigned int majorVersionIntroduced,
@@ -467,7 +468,7 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
       "ID ", this->GetPolicyIDString(iD).c_str());
     return;
   }
-  
+
   this->Policies[iD] = new cmPolicy(iD, idString,
                                     shortDescription,
                                     longDescription,
@@ -480,7 +481,7 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
 }
 
 //----------------------------------------------------------------------------
-bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf, 
+bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
                                     const char *version)
 {
   std::string ver = "2.4.0";
@@ -505,7 +506,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
     mf->IssueMessage(cmake::FATAL_ERROR, e.str());
     return false;
     }
-  
+
   // it is an error if the policy version is less than 2.4
   if (majorVer < 2 || (majorVer == 2 && minorVer < 4))
     {
@@ -547,7 +548,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
 
   // now loop over all the policies and set them as appropriate
   std::vector<cmPolicies::PolicyID> ancientPolicies;
-  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i 
+  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
     = this->Policies.begin();
   for (;i != this->Policies.end(); ++i)
   {
@@ -589,7 +590,7 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
   {
     return false;
   }
-  std::map<std::string,cmPolicies::PolicyID>::iterator pos = 
+  std::map<std::string,cmPolicies::PolicyID>::iterator pos =
     this->PolicyStringMap.find(id);
   if (pos == this->PolicyStringMap.end())
   {
@@ -601,7 +602,7 @@ bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
 
 std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid)
 {
-  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = 
+  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
     this->Policies.find(pid);
   if (pos == this->Policies.end())
   {
@@ -614,7 +615,7 @@ std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid)
 ///! return a warning string for a given policy
 std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
 {
-  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = 
+  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
     this->Policies.find(id);
   if (pos == this->Policies.end())
   {
@@ -633,12 +634,12 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id)
     "and suppress this warning.";
   return msg.str();
 }
-  
-  
+
+
 ///! return an error string for when a required policy is unspecified
 std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
 {
-  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = 
+  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
     this->Policies.find(id);
   if (pos == this->Policies.end())
   {
@@ -664,25 +665,25 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id)
 }
 
 ///! Get the default status for a policy
-cmPolicies::PolicyStatus 
+cmPolicies::PolicyStatus
 cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id)
 {
   // if the policy is not know then what?
-  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = 
+  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos =
     this->Policies.find(id);
   if (pos == this->Policies.end())
   {
     // TODO is this right?
     return cmPolicies::WARN;
   }
-  
+
   return pos->second->Status;
 }
 
 void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v)
 {
   // now loop over all the policies and set them as appropriate
-  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i 
+  std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
     = this->Policies.begin();
   for (;i != this->Policies.end(); ++i)
   {
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 23064dc..eb714c1 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -60,10 +60,10 @@ public:
   ///! convert a string policy ID into a number
   bool GetPolicyID(const char *id, /* out */ cmPolicies::PolicyID &pid);
   std::string GetPolicyIDString(cmPolicies::PolicyID pid);
-  
+
   ///! Get the default status for a policy
   cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id);
-  
+
   ///! Define a Policy for CMake
   void DefinePolicy(cmPolicies::PolicyID id,
                     const char *stringID,
@@ -80,7 +80,7 @@ public:
 
   ///! return a warning string for a given policy
   std::string GetPolicyWarning(cmPolicies::PolicyID id);
-  
+
   ///! return an error string for when a required policy is unspecified
   std::string GetRequiredPolicyError(cmPolicies::PolicyID id);
 

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

Summary of changes:
 Source/cmPolicies.cxx                   |   55 ++++++++++++++++++-------------
 Source/cmPolicies.h                     |    7 ++--
 Source/cmTargetLinkLibrariesCommand.cxx |   45 +++++++++++++++++++++----
 3 files changed, 74 insertions(+), 33 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list