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  7362f0a07b892400134b5bc5c308633059eaa788 (commit)
       via  53ad304517d5c0d036127a230948f4c8fe080246 (commit)
      from  6201a5f4b166b600ff0e31b2437107ac28d89735 (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=7362f0a07b892400134b5bc5c308633059eaa788
commit 7362f0a07b892400134b5bc5c308633059eaa788
Merge: 6201a5f 53ad304
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Tue Feb 11 11:46:06 2014 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Tue Feb 11 11:46:06 2014 -0500

    Merge topic 'backward-compatibility' into next
    
    53ad3045 cmTarget: Add policy to avoid variable expansion in source lists.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53ad304517d5c0d036127a230948f4c8fe080246
commit 53ad304517d5c0d036127a230948f4c8fe080246
Author:     Stephen Kelly <steve...@gmail.com>
AuthorDate: Tue Feb 11 17:41:24 2014 +0100
Commit:     Stephen Kelly <steve...@gmail.com>
CommitDate: Tue Feb 11 17:42:42 2014 +0100

    cmTarget: Add policy to avoid variable expansion in source lists.

diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 9cfa1e4..78453db 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -333,6 +333,11 @@ cmPolicies::cmPolicies()
     CMP0048, "CMP0048",
     "project() command manages VERSION variables.",
     3,0,0, cmPolicies::WARN);
+
+  this->DefinePolicy(
+    CMP0049, "CMP0049",
+    "Do not expand variables in target source entries.",
+    3,0,0, cmPolicies::WARN);
 }
 
 cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index f9a4768..9523650 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -102,6 +102,7 @@ public:
     CMP0046, ///< Error on non-existent dependency in add_dependencies
     CMP0047, ///< Use QCC compiler id for the qcc drivers on QNX.
     CMP0048, ///< project() command manages VERSION variables
+    CMP0049, ///< Do not expand variables in target source entries
 
     /** \brief Always the last entry.
      *
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index d440f7c..3e96b69 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -590,6 +590,38 @@ cmSourceFile* cmTarget::AddSource(const char* s)
   // For backwards compatibility replace varibles in source names.
   // This should eventually be removed.
   this->Makefile->ExpandVariablesInString(src);
+  if (src != s)
+    {
+    cmOStringStream e;
+    bool noMessage = false;
+    cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+    switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0049))
+      {
+      case cmPolicies::WARN:
+        e << (this->Makefile->GetPolicies()
+              ->GetPolicyWarning(cmPolicies::CMP0049)) << "\n";
+        break;
+      case cmPolicies::OLD:
+        noMessage = true;
+        break;
+      case cmPolicies::REQUIRED_ALWAYS:
+      case cmPolicies::REQUIRED_IF_USED:
+      case cmPolicies::NEW:
+        messageType = cmake::FATAL_ERROR;
+      }
+    if (!noMessage)
+      {
+      e << "Legacy variable expansion in source file \""
+        << s << "\" expanded to \"" << src << "\" in target \""
+        << this->GetName() << "\".  This behavior will be removed in a "
+        "future version of CMake.";
+      this->Makefile->IssueMessage(messageType, e.str().c_str());
+      if (messageType == cmake::FATAL_ERROR)
+        {
+        return 0;
+        }
+      }
+    }
 
   cmSourceFile* sf = this->Makefile->GetOrCreateSource(src.c_str());
   this->AddSourceFile(sf);
diff --git a/Tests/RunCMake/CMP0049/CMP0049-NEW-result.txt 
b/Tests/RunCMake/CMP0049/CMP0049-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt 
b/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt
new file mode 100644
index 0000000..ff787e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at CMP0049-NEW.cmake:5 \(add_library\):
+  Legacy variable expansion in source file "\${tgt_srcs}" expanded to
+  "empty.cpp" in target "tgt".  This behavior will be removed in a future
+  version of CMake.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake 
b/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake
new file mode 100644
index 0000000..85b5aa8
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-NEW.cmake
@@ -0,0 +1,5 @@
+
+cmake_policy(SET CMP0049 NEW)
+
+set(tgt_srcs empty.cpp)
+add_library(tgt \${tgt_srcs})
diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt 
b/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt 
b/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-OLD-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake 
b/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake
new file mode 100644
index 0000000..ae6fd3b
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-OLD.cmake
@@ -0,0 +1,5 @@
+
+cmake_policy(SET CMP0049 OLD)
+
+set(tgt_srcs empty.cpp)
+add_library(tgt \${tgt_srcs})
diff --git a/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt 
b/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt 
b/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt
new file mode 100644
index 0000000..0cf5ce3
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) at CMP0049-WARN.cmake:3 \(add_library\):
+  Policy CMP0049 is not set: Do not expand variables in target source
+  entries.  Run "cmake --help-policy CMP0049" for policy details.  Use the
+  cmake_policy command to set the policy and suppress this warning.
+
+  Legacy variable expansion in source file "\${tgt_srcs}" expanded to
+  "empty.cpp" in target "tgt".  This behavior will be removed in a future
+  version of CMake.
+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/CMP0049/CMP0049-WARN.cmake 
b/Tests/RunCMake/CMP0049/CMP0049-WARN.cmake
new file mode 100644
index 0000000..ada082e
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMP0049-WARN.cmake
@@ -0,0 +1,3 @@
+
+set(tgt_srcs empty.cpp)
+add_library(tgt \${tgt_srcs})
diff --git a/Tests/RunCMake/CMP0049/CMakeLists.txt 
b/Tests/RunCMake/CMP0049/CMakeLists.txt
new file mode 100644
index 0000000..2f10cb0
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(${RunCMake_TEST} CXX)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/CMP0049/RunCMakeTest.cmake 
b/Tests/RunCMake/CMP0049/RunCMakeTest.cmake
new file mode 100644
index 0000000..a8aa9d9
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0049-OLD)
+run_cmake(CMP0049-NEW)
+run_cmake(CMP0049-WARN)
diff --git a/Tests/RunCMake/CMP0049/empty.cpp b/Tests/RunCMake/CMP0049/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/CMP0049/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+  return 0;
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index c29b736..ef6f69d 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -32,6 +32,7 @@ endif()
 add_RunCMake_test(CMP0043)
 add_RunCMake_test(CMP0045)
 add_RunCMake_test(CMP0046)
+add_RunCMake_test(CMP0049)
 add_RunCMake_test(CTest)
 if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
   add_RunCMake_test(CompilerChange)

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

Summary of changes:
 Source/cmPolicies.cxx                              |    5 +++
 Source/cmPolicies.h                                |    1 +
 Source/cmTarget.cxx                                |   32 ++++++++++++++++++++
 .../CMP0049-NEW-result.txt}                        |    0
 Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt      |    6 ++++
 Tests/RunCMake/CMP0049/CMP0049-NEW.cmake           |    5 +++
 .../CMP0049-OLD-result.txt}                        |    0
 .../CMP0049-OLD-stderr.txt}                        |    0
 Tests/RunCMake/CMP0049/CMP0049-OLD.cmake           |    5 +++
 .../CMP0049-WARN-result.txt}                       |    0
 Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt     |   11 +++++++
 Tests/RunCMake/CMP0049/CMP0049-WARN.cmake          |    3 ++
 Tests/RunCMake/{CMP0038 => CMP0049}/CMakeLists.txt |    0
 Tests/RunCMake/CMP0049/RunCMakeTest.cmake          |    5 +++
 Tests/RunCMake/{CMP0022 => CMP0049}/empty.cpp      |    0
 Tests/RunCMake/CMakeLists.txt                      |    1 +
 16 files changed, 74 insertions(+)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => 
CMP0049/CMP0049-NEW-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CMP0049/CMP0049-NEW-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0049/CMP0049-NEW.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => 
CMP0049/CMP0049-OLD-result.txt} (100%)
 copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-exe-stderr.txt => 
CMP0049/CMP0049-OLD-stderr.txt} (100%)
 create mode 100644 Tests/RunCMake/CMP0049/CMP0049-OLD.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => 
CMP0049/CMP0049-WARN-result.txt} (100%)
 create mode 100644 Tests/RunCMake/CMP0049/CMP0049-WARN-stderr.txt
 create mode 100644 Tests/RunCMake/CMP0049/CMP0049-WARN.cmake
 copy Tests/RunCMake/{CMP0038 => CMP0049}/CMakeLists.txt (100%)
 create mode 100644 Tests/RunCMake/CMP0049/RunCMakeTest.cmake
 copy Tests/RunCMake/{CMP0022 => CMP0049}/empty.cpp (100%)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to