[Cmake-commits] CMake branch, next, updated. v2.8.12-3732-g9e72c83
Stephen Kelly
steveire at gmail.com
Wed Oct 9 12:34:20 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 9e72c837076f3cb0040a52d75cb58fad58d17bc4 (commit)
via 0f45e454b640044e6eacba9d8457aa2f637952a1 (commit)
from 1e866cb43dee3504f987c9fabe8414fd12a7b251 (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=9e72c837076f3cb0040a52d75cb58fad58d17bc4
commit 9e72c837076f3cb0040a52d75cb58fad58d17bc4
Merge: 1e866cb 0f45e45
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 9 12:34:08 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 9 12:34:08 2013 -0400
Merge topic 'target-LOCATION-policy' into next
0f45e45 Deprecate the LOCATION target property with a policy.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f45e454b640044e6eacba9d8457aa2f637952a1
commit 0f45e454b640044e6eacba9d8457aa2f637952a1
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jun 28 16:37:39 2013 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 9 18:33:09 2013 +0200
Deprecate the LOCATION target property with a policy.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 1d3469f..56e79ff 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -637,6 +637,24 @@ cmPolicies::cmPolicies()
"The OLD behavior for this policy is to use compiler id \"Clang\". "
"The NEW behavior for this policy is to use compiler id \"AppleClang\".",
2,8,13,0, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0026, "CMP0026",
+ "Disallow use of the LOCATION target property.",
+ "CMake 2.8.12 and lower allowed reading the LOCATION target property to "
+ "determine the eventual location of build targets. This relies on the "
+ "assumption that all necessary information is available at "
+ "configure-time to determine the final location and filename of the "
+ "target. However, this property is not fully determined until later at "
+ "generate-time. At generate time, the $<TARGET_FILE> generator "
+ "expression can be used to determine the eventual LOCATION of a target "
+ "output."
+ "\n"
+ "The OLD behavior for this policy is to allow reading the LOCATION "
+ "property from build-targets. "
+ "The NEW behavior for this policy is to not to allow reading the "
+ "LOCATION property from build-targets.",
+ 2,8,13,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index ec8959d..e33171b 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -76,6 +76,7 @@ public:
CMP0023, ///< Disallow mixing keyword and plain tll signatures
CMP0024, ///< Disallow including export() result.
CMP0025, ///< Compiler id for Apple Clang is now AppleClang
+ CMP0026, ///< Disallow use of the LOCATION target property.
/** \brief Always the last entry.
*
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1c04e4e..43d9ed1 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -4130,6 +4130,43 @@ const char *cmTarget::GetProperty(const char* prop)
}
//----------------------------------------------------------------------------
+bool cmTarget::HandleLocationPropertyPolicy()
+{
+ if (this->IsImported())
+ {
+ return true;
+ }
+ const char *modal = 0;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0026))
+ {
+ case cmPolicies::WARN:
+ modal = "should";
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ modal = "may";
+ messageType = cmake::FATAL_ERROR;
+ }
+
+ if (modal)
+ {
+ cmOStringStream e;
+ e << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0026)) << "\n";
+ e << "The LOCATION property " << modal << " not be read from target \""
+ << this->GetName() << "\". Use the target name directly with "
+ "add_custom_command, or use the generator expression $<TARGET_FILE>, "
+ "as appropriate.\n";
+ this->Makefile->IssueMessage(messageType, e.str().c_str());
+ }
+
+ return messageType != cmake::FATAL_ERROR;
+}
+
+//----------------------------------------------------------------------------
const char *cmTarget::GetProperty(const char* prop,
cmProperty::ScopeType scope)
{
@@ -4154,6 +4191,11 @@ const char *cmTarget::GetProperty(const char* prop,
{
if(strcmp(prop,"LOCATION") == 0)
{
+ if (!this->HandleLocationPropertyPolicy())
+ {
+ return 0;
+ }
+
// Set the LOCATION property of the target.
//
// For an imported target this is the location of an arbitrary
@@ -4169,6 +4211,10 @@ const char *cmTarget::GetProperty(const char* prop,
// Support "LOCATION_<CONFIG>".
if(strncmp(prop, "LOCATION_", 9) == 0)
{
+ if (!this->HandleLocationPropertyPolicy())
+ {
+ return 0;
+ }
std::string configName = prop+9;
this->SetProperty(prop, this->GetLocation(configName.c_str()));
}
@@ -4181,6 +4227,10 @@ const char *cmTarget::GetProperty(const char* prop,
std::string configName(prop, len-9);
if(configName != "IMPORTED")
{
+ if (!this->HandleLocationPropertyPolicy())
+ {
+ return 0;
+ }
this->SetProperty(prop, this->GetLocation(configName.c_str()));
}
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a88c5ec..3c36da7 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -554,6 +554,8 @@ public:
{ return this->TargetTypeValue == STATIC_LIBRARY; }
private:
+ bool HandleLocationPropertyPolicy();
+
// The set of include directories that are marked as system include
// directories.
std::set<cmStdString> SystemIncludeDirectories;
diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-result.txt b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake
new file mode 100644
index 0000000..650c8a5
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake
@@ -0,0 +1,6 @@
+
+enable_language(CXX)
+
+add_library(someimportedlib SHARED IMPORTED)
+
+get_target_property(_loc someimportedlib LOCATION)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-NEW-result.txt b/Tests/RunCMake/CMP0026/CMP0026-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt
new file mode 100644
index 0000000..2a05a4d
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at CMP0026-NEW.cmake:7 \(get_target_property\):
+ Policy CMP0026 is not set: Disallow use of the LOCATION target property.
+ Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ The LOCATION property may not be read from target "somelib". Use the
+ target name directly with add_custom_command, or use the generator
+ expression \$<TARGET_FILE>, as appropriate.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-NEW.cmake b/Tests/RunCMake/CMP0026/CMP0026-NEW.cmake
new file mode 100644
index 0000000..1659ffc
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-NEW.cmake
@@ -0,0 +1,7 @@
+
+enable_language(CXX)
+
+cmake_policy(SET CMP0026 NEW)
+
+add_library(somelib empty.cpp)
+get_target_property(_loc somelib LOCATION)
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt
new file mode 100644
index 0000000..9b88194
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt
@@ -0,0 +1,12 @@
+CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\):
+ Policy CMP0026 is not set: Disallow use of the LOCATION target property.
+ Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ The LOCATION property should not be read from target "somelib". Use the
+ target name directly with add_custom_command, or use the generator
+ expression \$<TARGET_FILE>, as appropriate.
+
+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/CMP0026/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake
new file mode 100644
index 0000000..89c5a8a
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake
@@ -0,0 +1,5 @@
+
+enable_language(CXX)
+
+add_library(somelib empty.cpp)
+get_target_property(_loc somelib LOCATION)
diff --git a/Tests/RunCMake/CMP0026/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
new file mode 100644
index 0000000..68000a6
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0026-WARN)
+run_cmake(CMP0026-NEW)
+run_cmake(CMP0026-IMPORTED)
diff --git a/Tests/RunCMake/CMP0026/empty.cpp b/Tests/RunCMake/CMP0026/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/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 4fbc3b0..6d5b07b 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -53,6 +53,7 @@ endif()
add_RunCMake_test(CMP0019)
add_RunCMake_test(CMP0022)
+add_RunCMake_test(CMP0026)
add_RunCMake_test(CTest)
if(UNIX AND "${CMAKE_TEST_GENERATOR}" MATCHES "Unix Makefiles")
add_RunCMake_test(CompilerChange)
-----------------------------------------------------------------------
Summary of changes:
Source/cmPolicies.cxx | 18 +++++++
Source/cmPolicies.h | 1 +
Source/cmTarget.cxx | 50 ++++++++++++++++++++
Source/cmTarget.h | 2 +
.../CMP0026-IMPORTED-result.txt} | 0
.../CMP0026-IMPORTED-stderr.txt} | 0
Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake | 6 ++
.../CMP0026-NEW-result.txt} | 0
Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt | 11 ++++
Tests/RunCMake/CMP0026/CMP0026-NEW.cmake | 7 +++
.../CMP0026-WARN-result.txt} | 0
Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt | 12 +++++
Tests/RunCMake/CMP0026/CMP0026-WARN.cmake | 5 ++
.../RunCMake/{Configure => CMP0026}/CMakeLists.txt | 2 +-
Tests/RunCMake/CMP0026/RunCMakeTest.cmake | 5 ++
Tests/RunCMake/{CMP0022 => CMP0026}/empty.cpp | 0
Tests/RunCMake/CMakeLists.txt | 1 +
17 files changed, 119 insertions(+), 1 deletions(-)
copy Tests/RunCMake/{CMP0022/CMP0022-WARN-static-result.txt => CMP0026/CMP0026-IMPORTED-result.txt} (100%)
copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-static-link_libraries-stderr.txt => CMP0026/CMP0026-IMPORTED-stderr.txt} (100%)
create mode 100644 Tests/RunCMake/CMP0026/CMP0026-IMPORTED.cmake
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => CMP0026/CMP0026-NEW-result.txt} (100%)
create mode 100644 Tests/RunCMake/CMP0026/CMP0026-NEW-stderr.txt
create mode 100644 Tests/RunCMake/CMP0026/CMP0026-NEW.cmake
copy Tests/RunCMake/{CMP0022/CMP0022-WARN-static-result.txt => CMP0026/CMP0026-WARN-result.txt} (100%)
create mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt
create mode 100644 Tests/RunCMake/CMP0026/CMP0026-WARN.cmake
copy Tests/RunCMake/{Configure => CMP0026}/CMakeLists.txt (62%)
create mode 100644 Tests/RunCMake/CMP0026/RunCMakeTest.cmake
copy Tests/RunCMake/{CMP0022 => CMP0026}/empty.cpp (100%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list