[Cmake-commits] CMake branch, next, updated. v3.2.2-2723-g355a81a
Stephen Kelly
steveire at gmail.com
Thu May 14 13:09:41 EDT 2015
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 355a81aed21eaa1a8ba74c981624501344157109 (commit)
via f79d60255ecdefd51750aed1f2fcc86df280c984 (commit)
via 501c237a83001a8783b2249bd5f5066c3472a2aa (commit)
from 9974c7a0ee2db94a12bcc432b8316aaaaaaa5b68 (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=355a81aed21eaa1a8ba74c981624501344157109
commit 355a81aed21eaa1a8ba74c981624501344157109
Merge: 9974c7a f79d602
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu May 14 13:09:39 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu May 14 13:09:39 2015 -0400
Merge topic 'disallow-install-of-export' into next
f79d6025 install: Disallow installing export() result.
501c237a install: Use an intermediate filesVector variable.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f79d60255ecdefd51750aed1f2fcc86df280c984
commit f79d60255ecdefd51750aed1f2fcc86df280c984
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu May 14 19:08:27 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Thu May 14 19:08:58 2015 +0200
install: Disallow installing export() result.
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index e59cce7..2cc3a47 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -119,3 +119,4 @@ All Policies
/policy/CMP0059
/policy/CMP0060
/policy/CMP0061
+ /policy/CMP0062
diff --git a/Help/policy/CMP0062.rst b/Help/policy/CMP0062.rst
new file mode 100644
index 0000000..632cfc2
--- /dev/null
+++ b/Help/policy/CMP0062.rst
@@ -0,0 +1,27 @@
+CMP0062
+-------
+
+Disallow install() of export() result.
+
+The :command:`export()` command generates a file containing
+:ref:`Imported Targets`, which is suitable for use from the build
+directory. It is not suitable for installation because it contains absolute
+paths to buildsystem locations, and is particular to a single build
+configuration.
+
+The :command:`install(EXPORT)` generates and installs files which contain
+:ref:`Imported Targets`. These files are generated with relative paths
+(unless the user specifies absolute paths), and are designed for
+multi-configuration use.
+
+CMake 3.3 no longer allows the use of the :command:`install(FILES)` command
+with the result of the :command:`export()` command.
+
+The ``OLD`` behavior for this policy is to allow installing the result of
+an :command:`export()` command. The ``NEW`` behavior for this policy is
+not to allow installing the result of an :command:`export()` command.
+
+This policy was introduced in CMake version 3.3. CMake version
+|release| warns when the policy is not set and uses ``OLD`` behavior. Use
+the :command:`cmake_policy()` command to set it to ``OLD`` or ``NEW``
+explicitly.
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 24de1b5..899b088 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -871,6 +871,47 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
return false;
}
+ cmPolicies::PolicyStatus status =
+ this->Makefile->GetPolicyStatus(cmPolicies::CMP0062);
+
+ cmGlobalGenerator *gg = this->Makefile->GetGlobalGenerator();
+ for(std::vector<std::string>::const_iterator fileIt = filesVector.begin();
+ fileIt != filesVector.end(); ++fileIt)
+ {
+ if (gg->IsExportedTargetsFile(*fileIt))
+ {
+ const char *modal = 0;
+ std::ostringstream e;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+
+ switch(status)
+ {
+ case cmPolicies::WARN:
+ e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0062) << "\n";
+ modal = "should";
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ modal = "may";
+ messageType = cmake::FATAL_ERROR;
+ }
+ if (modal)
+ {
+ e << "The file\n " << *fileIt << "\nwas generated by the export() "
+ "command. It " << modal << " not be installed with the "
+ "install() command. Use the install(EXPORT) mechanism "
+ "instead. See the cmake-packages(7) manual for more.\n";
+ this->Makefile->IssueMessage(messageType, e.str());
+ if (messageType == cmake::FATAL_ERROR)
+ {
+ return false;
+ }
+ }
+ }
+ }
+
if (!ica.Finalize())
{
return false;
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 536dcdc..7df4ee2 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -211,6 +211,9 @@ class cmPolicy;
3, 3, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0061, \
"CTest does not by default tell make to ignore errors (-i).", \
+ 3, 3, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0062, \
+ "Disallow install() of export() result", \
3, 3, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
diff --git a/Tests/RunCMake/install/CMP0062-NEW-result.txt b/Tests/RunCMake/install/CMP0062-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/CMP0062-NEW-stderr.txt b/Tests/RunCMake/install/CMP0062-NEW-stderr.txt
new file mode 100644
index 0000000..b03f629
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at CMP0062-NEW.cmake:[0-9]+ \(install\):
+ The file
+
+ .*Tests/RunCMake/install/CMP0062-NEW-build/exported.cmake
+
+ was generated by the export\(\) command. It may not be installed with the
+ install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
+ cmake-packages\(7\) manual for more.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/install/CMP0062-NEW.cmake b/Tests/RunCMake/install/CMP0062-NEW.cmake
new file mode 100644
index 0000000..a696f56
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW.cmake
@@ -0,0 +1,6 @@
+
+cmake_policy(SET CMP0062 NEW)
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/CMP0062-OLD-result.txt b/Tests/RunCMake/install/CMP0062-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/install/CMP0062-OLD.cmake b/Tests/RunCMake/install/CMP0062-OLD.cmake
new file mode 100644
index 0000000..94b809a
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-OLD.cmake
@@ -0,0 +1,6 @@
+
+cmake_policy(SET CMP0062 OLD)
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/CMP0062-WARN-result.txt b/Tests/RunCMake/install/CMP0062-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/install/CMP0062-WARN-stderr.txt b/Tests/RunCMake/install/CMP0062-WARN-stderr.txt
new file mode 100644
index 0000000..64e3c81
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN-stderr.txt
@@ -0,0 +1,16 @@
+CMake Warning \(dev\) at CMP0062-WARN.cmake:[0-9]+ \(install\):
+ Policy CMP0062 is not set: Disallow install\(\) of export\(\) result Run "cmake
+ --help-policy CMP0062" for policy details. Use the cmake_policy command to
+ set the policy and suppress this warning.
+
+ The file
+
+ .*Tests/RunCMake/install/CMP0062-WARN-build/exported.cmake
+
+ was generated by the export\(\) command. It should not be installed with the
+ install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
+ cmake-packages\(7\) manual for more.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/install/CMP0062-WARN.cmake b/Tests/RunCMake/install/CMP0062-WARN.cmake
new file mode 100644
index 0000000..0435a64
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN.cmake
@@ -0,0 +1,4 @@
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 7149603..a5f5bd0 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -7,3 +7,6 @@ run_cmake(SkipInstallRulesWarning)
run_cmake(SkipInstallRulesNoWarning1)
run_cmake(SkipInstallRulesNoWarning2)
run_cmake(TARGETS-DESTINATION-bad)
+run_cmake(CMP0062-OLD)
+run_cmake(CMP0062-NEW)
+run_cmake(CMP0062-WARN)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=501c237a83001a8783b2249bd5f5066c3472a2aa
commit 501c237a83001a8783b2249bd5f5066c3472a2aa
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu May 14 18:23:43 2015 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Thu May 14 18:23:43 2015 +0200
install: Use an intermediate filesVector variable.
Reduce noise.
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index 78603c8..24de1b5 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -848,13 +848,15 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
return false;
}
+ const std::vector<std::string>& filesVector = files.GetVector();
+
// Check if there is something to do.
- if(files.GetVector().empty())
+ if(filesVector.empty())
{
return true;
}
- if(!ica.GetRename().empty() && files.GetVector().size() > 1)
+ if(!ica.GetRename().empty() && filesVector.size() > 1)
{
// The rename option works only with one file.
std::ostringstream e;
@@ -864,7 +866,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args)
}
std::vector<std::string> absFiles;
- if (!this->MakeFilesFullPath(args[0].c_str(), files.GetVector(), absFiles))
+ if (!this->MakeFilesFullPath(args[0].c_str(), filesVector, absFiles))
{
return false;
}
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-policies.7.rst | 1 +
Help/policy/CMP0062.rst | 27 +++++++++++
Source/cmInstallCommand.cxx | 49 ++++++++++++++++++--
Source/cmPolicies.h | 3 ++
.../CMP0062-NEW-result.txt} | 0
Tests/RunCMake/install/CMP0062-NEW-stderr.txt | 11 +++++
Tests/RunCMake/install/CMP0062-NEW.cmake | 6 +++
.../CMP0062-OLD-result.txt} | 0
Tests/RunCMake/install/CMP0062-OLD.cmake | 6 +++
.../CMP0062-WARN-result.txt} | 0
Tests/RunCMake/install/CMP0062-WARN-stderr.txt | 16 +++++++
Tests/RunCMake/install/CMP0062-WARN.cmake | 4 ++
Tests/RunCMake/install/RunCMakeTest.cmake | 3 ++
13 files changed, 123 insertions(+), 3 deletions(-)
create mode 100644 Help/policy/CMP0062.rst
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => install/CMP0062-NEW-result.txt} (100%)
create mode 100644 Tests/RunCMake/install/CMP0062-NEW-stderr.txt
create mode 100644 Tests/RunCMake/install/CMP0062-NEW.cmake
copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => install/CMP0062-OLD-result.txt} (100%)
create mode 100644 Tests/RunCMake/install/CMP0062-OLD.cmake
copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => install/CMP0062-WARN-result.txt} (100%)
create mode 100644 Tests/RunCMake/install/CMP0062-WARN-stderr.txt
create mode 100644 Tests/RunCMake/install/CMP0062-WARN.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list