[Cmake-commits] CMake branch, next, updated. v2.8.11-1984-gdbe364e

Stephen Kelly steveire at gmail.com
Thu May 16 14:02:50 EDT 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  dbe364e442f0956b6947fd8c274bd98f78264fa1 (commit)
       via  ae3384ba15bdb22c150b05c2a1fcbf2287cab317 (commit)
      from  f4d3fa62b0cd6ff07158a9878152fcd6fd7b3ddd (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=dbe364e442f0956b6947fd8c274bd98f78264fa1
commit dbe364e442f0956b6947fd8c274bd98f78264fa1
Merge: f4d3fa6 ae3384b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu May 16 14:02:48 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 16 14:02:48 2013 -0400

    Merge topic 'error-on-exported-missing-include-dir' into next
    
    ae3384b Error on relative path in INCLUDE_DIRECTORIES target property.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae3384ba15bdb22c150b05c2a1fcbf2287cab317
commit ae3384ba15bdb22c150b05c2a1fcbf2287cab317
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Mar 26 18:08:29 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu May 16 20:01:51 2013 +0200

    Error on relative path in INCLUDE_DIRECTORIES target property.
    
    As the existing behavior is present in earlier CMake versions, this needs
    a policy.

diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 831e92e..09e1051 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -529,6 +529,20 @@ cmPolicies::cmPolicies()
     "The NEW behavior for this policy is to link executables to "
     "qtmain.lib automatically when they link to QtCore IMPORTED target.",
     2,8,11,0, cmPolicies::WARN);
+
+  this->DefinePolicy(
+    CMP0021, "CMP0021",
+    "Fatal error on relative paths in INCLUDE_DIRECTORIES target property.",
+    "CMake 2.8.10.2 and lower allowed the INCLUDE_DIRECTORIES target "
+    "property to contain relative paths.  The base path for such relative "
+    "entries is not well defined.  CMake 2.8.12 issues a FATAL_ERROR if the "
+    "INCLUDE_DIRECTORIES property contains a relative path."
+    "\n"
+    "The OLD behavior for this policy is not to warn about relative paths in "
+    "the INCLUDE_DIRECTORIES target property.  "
+    "The NEW behavior for this policy is to issue a FATAL_ERROR if "
+    "INCLUDE_DIRECTORIES contains a relative path.",
+    2,8,11,20130516, cmPolicies::WARN);
 }
 
 cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index c11af07..a033e87 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -70,6 +70,8 @@ public:
     /// instead.
     CMP0019, ///< No variable re-expansion in include and link info
     CMP0020, ///< Automatically link Qt executables to qtmain target
+    CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES
+    /// target property
 
     /** \brief Always the last entry.
      *
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d14bfca..fab8f19 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -191,6 +191,7 @@ cmTarget::cmTarget()
   this->PolicyStatusCMP0004 = cmPolicies::WARN;
   this->PolicyStatusCMP0008 = cmPolicies::WARN;
   this->PolicyStatusCMP0020 = cmPolicies::WARN;
+  this->PolicyStatusCMP0021 = cmPolicies::WARN;
   this->LinkLibrariesAnalyzed = false;
   this->HaveInstallRule = false;
   this->DLLPlatform = false;
@@ -1568,6 +1569,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
     this->Makefile->GetPolicyStatus(cmPolicies::CMP0008);
   this->PolicyStatusCMP0020 =
     this->Makefile->GetPolicyStatus(cmPolicies::CMP0020);
+  this->PolicyStatusCMP0021 =
+    this->Makefile->GetPolicyStatus(cmPolicies::CMP0021);
 }
 
 //----------------------------------------------------------------------------
@@ -2876,14 +2879,41 @@ static void processIncludeDirectories(cmTarget *tgt,
 
       if (!cmSystemTools::FileIsFullPath(li->c_str()))
         {
+        cmOStringStream e;
+        bool noMessage = false;
+        cmake::MessageType messageType = cmake::FATAL_ERROR;
         if (!(*it)->TargetName.empty())
           {
-          cmOStringStream e;
           e << "Target \"" << (*it)->TargetName << "\" contains relative "
             "path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
             "  \"" << *li << "\" ";
-          tgt->GetMakefile()->IssueMessage(cmake::FATAL_ERROR,
-                                           e.str().c_str());
+          }
+        else
+          {
+          switch(tgt->GetPolicyStatusCMP0021())
+            {
+            case cmPolicies::WARN:
+              {
+              cmOStringStream w;
+              e << (mf->GetPolicies()
+                    ->GetPolicyWarning(cmPolicies::CMP0021)) << "\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;
+            }
+          e << "Found relative path while evaluating include directories of "
+          "\"" << tgt->GetName() << "\":\n  \"" << *li << "\"\n";
+          }
+        if (!noMessage)
+          {
+          tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str());
           return;
           }
         }
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 9d46796..daf9540 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -106,6 +106,10 @@ public:
   cmPolicies::PolicyStatus GetPolicyStatusCMP0020() const
     { return this->PolicyStatusCMP0020; }
 
+  /** Get the status of policy CMP0021 when the target was created.  */
+  cmPolicies::PolicyStatus GetPolicyStatusCMP0021() const
+    { return this->PolicyStatusCMP0021; }
+
   /**
    * Get the list of the custom commands for this target
    */
@@ -664,6 +668,7 @@ private:
   cmPolicies::PolicyStatus PolicyStatusCMP0004;
   cmPolicies::PolicyStatus PolicyStatusCMP0008;
   cmPolicies::PolicyStatus PolicyStatusCMP0020;
+  cmPolicies::PolicyStatus PolicyStatusCMP0021;
 
   // Internal representation details.
   friend class cmTargetInternals;
diff --git a/Tests/RunCMake/include_directories/CMP0021-result.txt b/Tests/RunCMake/include_directories/CMP0021-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/include_directories/CMP0021-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/include_directories/CMP0021-stderr.txt b/Tests/RunCMake/include_directories/CMP0021-stderr.txt
new file mode 100644
index 0000000..c0781e7
--- /dev/null
+++ b/Tests/RunCMake/include_directories/CMP0021-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error in CMakeLists.txt:
+  Found relative path while evaluating include directories of "userTarget":
+
+    "foo"
diff --git a/Tests/RunCMake/include_directories/CMP0021.cmake b/Tests/RunCMake/include_directories/CMP0021.cmake
new file mode 100644
index 0000000..40c5977
--- /dev/null
+++ b/Tests/RunCMake/include_directories/CMP0021.cmake
@@ -0,0 +1,8 @@
+
+cmake_policy(SET CMP0021 NEW)
+
+add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
+set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>")
+
+add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp")
+target_include_directories(userTarget PRIVATE $<TARGET_PROPERTY:testTarget,INTERFACE_INCLUDE_DIRECTORIES>)
diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
index f516086..520dd44 100644
--- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake
@@ -8,3 +8,4 @@ run_cmake(BinaryDirectoryInInterface)
 run_cmake(RelativePathInInterface)
 run_cmake(ImportedTarget)
 run_cmake(RelativePathInGenex)
+run_cmake(CMP0021)

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

Summary of changes:
 Source/cmPolicies.cxx                              |   14 ++++++++
 Source/cmPolicies.h                                |    2 +
 Source/cmTarget.cxx                                |   36 ++++++++++++++++++--
 Source/cmTarget.h                                  |    5 +++
 .../CMP0021-result.txt}                            |    0
 .../include_directories/CMP0021-stderr.txt         |    4 ++
 .../{RelativePathInGenex.cmake => CMP0021.cmake}   |    4 +-
 .../include_directories/RunCMakeTest.cmake         |    1 +
 8 files changed, 61 insertions(+), 5 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => include_directories/CMP0021-result.txt} (100%)
 create mode 100644 Tests/RunCMake/include_directories/CMP0021-stderr.txt
 copy Tests/RunCMake/include_directories/{RelativePathInGenex.cmake => CMP0021.cmake} (60%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list