[Cmake-commits] CMake branch, next, updated. v3.3.2-3221-g350d20c
Brad King
brad.king at kitware.com
Wed Sep 23 15:00:28 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 350d20c9fca2f6e4d49f2177dd62de4ff85333ee (commit)
via 69ab5f55026c7e884a70f04aa7ddef776f74305b (commit)
via 17aa6fd36284ad937bfce370cf8d5e5de87a334b (commit)
from ca3090c4dd17b2fbdb2fdce72d33846e33403258 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=350d20c9fca2f6e4d49f2177dd62de4ff85333ee
commit 350d20c9fca2f6e4d49f2177dd62de4ff85333ee
Merge: ca3090c 69ab5f5
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 23 15:00:26 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Sep 23 15:00:26 2015 -0400
Merge topic 'install-files-dest-genex' into next
69ab5f55 Tests: Cover install(FILES) with a genex DESTINATION
17aa6fd3 install: Allow generator expressions in FILES DESTINATION
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69ab5f55026c7e884a70f04aa7ddef776f74305b
commit 69ab5f55026c7e884a70f04aa7ddef776f74305b
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 23 14:41:52 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 23 14:41:52 2015 -0400
Tests: Cover install(FILES) with a genex DESTINATION
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 2b9e844..1e52a09 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -29,14 +29,14 @@ add_custom_command(TARGET testLib1 POST_BUILD
$<TARGET_FILE:testLib1>.genex
)
install(FILES $<TARGET_FILE:testLib1>.genex
- DESTINATION lib
+ DESTINATION $<1:lib>$<0:/wrong>
)
set_property(TARGET testLib1 PROPERTY MY_FILES
${CMAKE_CURRENT_SOURCE_DIR}/testLib1file1.txt
${CMAKE_CURRENT_SOURCE_DIR}/testLib1file2.txt
)
install(FILES $<TARGET_PROPERTY:testLib1,MY_FILES>
- DESTINATION doc
+ DESTINATION $<1:doc>$<0:/wrong>
)
# Test library with empty link interface. Link it to an implementation
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt b/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<NOTAGENEX>
+
+ Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake b/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake
new file mode 100644
index 0000000..0fda078
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake
@@ -0,0 +1 @@
+install(FILES empty.c DESTINATION $<NOTAGENEX>)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index a5f5bd0..2ce0095 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -6,6 +6,7 @@ run_cmake(DIRECTORY-message-lazy)
run_cmake(SkipInstallRulesWarning)
run_cmake(SkipInstallRulesNoWarning1)
run_cmake(SkipInstallRulesNoWarning2)
+run_cmake(FILES-DESTINATION-bad)
run_cmake(TARGETS-DESTINATION-bad)
run_cmake(CMP0062-OLD)
run_cmake(CMP0062-NEW)
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
index cc3c3be..3227e3f 100644
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ b/Tests/SimpleInstall/CMakeLists.txt
@@ -209,9 +209,9 @@ else()
ARCHIVE DESTINATION MyTest/lib/static
OPTIONAL # for coverage...target should always exist
)
- install(FILES lib1.h DESTINATION MyTest/include/foo)
+ install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>)
install(FILES lib2.h
- DESTINATION MyTest/include/foo
+ DESTINATION $<1:MyTest/include/foo>$<0:/wrong>
COMPONENT Development
PERMISSIONS OWNER_READ OWNER_WRITE
RENAME lib2renamed.h
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
index cc3c3be..3227e3f 100644
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ b/Tests/SimpleInstallS2/CMakeLists.txt
@@ -209,9 +209,9 @@ else()
ARCHIVE DESTINATION MyTest/lib/static
OPTIONAL # for coverage...target should always exist
)
- install(FILES lib1.h DESTINATION MyTest/include/foo)
+ install(FILES lib1.h DESTINATION MyTest/include/$<1:foo>$<0:/wrong>)
install(FILES lib2.h
- DESTINATION MyTest/include/foo
+ DESTINATION $<1:MyTest/include/foo>$<0:/wrong>
COMPONENT Development
PERMISSIONS OWNER_READ OWNER_WRITE
RENAME lib2renamed.h
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=17aa6fd36284ad937bfce370cf8d5e5de87a334b
commit 17aa6fd36284ad937bfce370cf8d5e5de87a334b
Author: Robert Goulet <robert.goulet at autodesk.com>
AuthorDate: Wed Sep 23 13:40:27 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 23 14:37:17 2015 -0400
install: Allow generator expressions in FILES DESTINATION
diff --git a/Help/command/install.rst b/Help/command/install.rst
index c99ed73..9c17bba 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -192,6 +192,10 @@ The list of ``files...`` given to ``FILES`` or ``PROGRAMS`` may use
However, if any item begins in a generator expression it must evaluate
to a full path.
+The install destination given to the files install ``DESTINATION`` may
+use "generator expressions" with the syntax ``$<...>``. See the
+:manual:`cmake-generator-expressions(7)` manual for available expressions.
+
Installing Directories
^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/release/dev/install-files-dest-genex.rst b/Help/release/dev/install-files-dest-genex.rst
new file mode 100644
index 0000000..b7aa8b3
--- /dev/null
+++ b/Help/release/dev/install-files-dest-genex.rst
@@ -0,0 +1,5 @@
+install-files-dest-genex
+------------------------
+
+* The :command:`install(FILES)` command ``DESTINATION`` option learned to
+ support :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index c18b174..e2c16c8 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -34,6 +34,12 @@ cmInstallFilesGenerator
Programs(programs),
Optional(optional)
{
+ // We need per-config actions if the destination has generator expressions.
+ if(cmGeneratorExpression::Find(Destination) != std::string::npos)
+ {
+ this->ActionsPerConfig = true;
+ }
+
// We need per-config actions if any files have generator expressions.
for(std::vector<std::string>::const_iterator i = files.begin();
!this->ActionsPerConfig && i != files.end(); ++i)
@@ -57,14 +63,25 @@ void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg)
}
//----------------------------------------------------------------------------
+std::string
+cmInstallFilesGenerator::GetDestination(std::string const& config) const
+{
+ cmGeneratorExpression ge;
+ return ge.Parse(this->Destination)
+ ->Evaluate(this->LocalGenerator->GetMakefile(), config);
+}
+
+//----------------------------------------------------------------------------
void cmInstallFilesGenerator::AddFilesInstallRule(
- std::ostream& os, Indent const& indent,
+ std::ostream& os,
+ const std::string config,
+ Indent const& indent,
std::vector<std::string> const& files)
{
// Write code to install the files.
const char* no_dir_permissions = 0;
this->AddInstallRule(os,
- this->Destination,
+ this->GetDestination(config),
(this->Programs
? cmInstallType_PROGRAMS
: cmInstallType_FILES),
@@ -84,7 +101,7 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
}
else
{
- this->AddFilesInstallRule(os, indent, this->Files);
+ this->AddFilesInstallRule(os, "", indent, this->Files);
}
}
@@ -102,5 +119,5 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os,
cmSystemTools::ExpandListArgument(cge->Evaluate(
this->LocalGenerator->GetMakefile(), config), files);
}
- this->AddFilesInstallRule(os, indent, files);
+ this->AddFilesInstallRule(os, config, indent, files);
}
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 00b3a79..bfe4039 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -32,12 +32,16 @@ public:
void Compute(cmLocalGenerator* lg);
+ std::string GetDestination(std::string const& config) const;
+
protected:
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
virtual void GenerateScriptForConfig(std::ostream& os,
const std::string& config,
Indent const& indent);
- void AddFilesInstallRule(std::ostream& os, Indent const& indent,
+ void AddFilesInstallRule(std::ostream& os,
+ const std::string config,
+ Indent const& indent,
std::vector<std::string> const& files);
cmLocalGenerator* LocalGenerator;
-----------------------------------------------------------------------
Summary of changes:
Help/command/install.rst | 4 ++++
Help/release/dev/install-files-dest-genex.rst | 5 ++++
Source/cmInstallFilesGenerator.cxx | 25 ++++++++++++++++----
Source/cmInstallFilesGenerator.h | 6 ++++-
Tests/ExportImport/Export/CMakeLists.txt | 4 ++--
.../FILES-DESTINATION-bad-result.txt} | 0
.../FILES-DESTINATION-bad-stderr.txt} | 0
Tests/RunCMake/install/FILES-DESTINATION-bad.cmake | 1 +
Tests/RunCMake/install/RunCMakeTest.cmake | 1 +
Tests/SimpleInstall/CMakeLists.txt | 4 ++--
Tests/SimpleInstallS2/CMakeLists.txt | 4 ++--
11 files changed, 43 insertions(+), 11 deletions(-)
create mode 100644 Help/release/dev/install-files-dest-genex.rst
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => install/FILES-DESTINATION-bad-result.txt} (100%)
copy Tests/RunCMake/{XcodeProject/XcodeAttributeGenexError-stderr.txt => install/FILES-DESTINATION-bad-stderr.txt} (100%)
create mode 100644 Tests/RunCMake/install/FILES-DESTINATION-bad.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list