[Cmake-commits] CMake branch, next, updated. v3.4.1-1940-ge0c8efb

Brad King brad.king at kitware.com
Wed Jan 13 09:10:10 EST 2016


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  e0c8efbea200d306fb8202750d400b58d3c7185a (commit)
       via  630c8aa8435fced988545d396714398faa3426b1 (commit)
      from  3f3e6ddf46580649e726293f64c6808256927167 (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=e0c8efbea200d306fb8202750d400b58d3c7185a
commit e0c8efbea200d306fb8202750d400b58d3c7185a
Merge: 3f3e6dd 630c8aa
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 13 09:10:09 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jan 13 09:10:09 2016 -0500

    Merge topic 'install-DIRECTORY-genex' into next
    
    630c8aa8 install: Allow generator expressions in DIRECTORY


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=630c8aa8435fced988545d396714398faa3426b1
commit 630c8aa8435fced988545d396714398faa3426b1
Author:     Yves Frederix <yves.frederix at gmail.com>
AuthorDate: Tue Jan 12 21:01:07 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 13 09:02:06 2016 -0500

    install: Allow generator expressions in DIRECTORY
    
    Teach install(DIRECTORY) to support generator expressions in the list
    of directories, much like install(FILES) already supports.

diff --git a/Help/command/install.rst b/Help/command/install.rst
index 423899e..5d2add7 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -271,9 +271,10 @@ will install the ``icons`` directory to ``share/myproj/icons`` and the
 file permissions, the scripts will be given specific permissions, and any
 ``CVS`` directories will be excluded.
 
-The install destination given to the directory install ``DESTINATION`` may
-use "generator expressions" with the syntax ``$<...>``.  See the
-:manual:`cmake-generator-expressions(7)` manual for available expressions.
+The list of ``dirs...`` given to ``DIRECTORY`` and the install destination
+given to the directory install ``DESTINATION`` may use "generator expressions"
+with the syntax ``$<...>``.  See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions.
 
 Custom Installation Logic
 ^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/release/dev/install-DIRECTORY-genex.rst b/Help/release/dev/install-DIRECTORY-genex.rst
new file mode 100644
index 0000000..e48f19b
--- /dev/null
+++ b/Help/release/dev/install-DIRECTORY-genex.rst
@@ -0,0 +1,6 @@
+install-DIRECTORY-genex
+-----------------------
+
+* The :command:`install(DIRECTORY)` command learned to support
+  :manual:`generator expressions <cmake-generator-expressions(7)>`
+  in the list of directories.
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index ea27f61..f2e8609 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -36,6 +36,16 @@ cmInstallDirectoryGenerator
     {
     this->ActionsPerConfig = true;
     }
+
+  // We need per-config actions if any directories have generator expressions.
+  for(std::vector<std::string>::const_iterator i = dirs.begin();
+      !this->ActionsPerConfig && i != dirs.end(); ++i)
+    {
+    if(cmGeneratorExpression::Find(*i) != std::string::npos)
+      {
+      this->ActionsPerConfig = true;
+      }
+    }
 }
 
 //----------------------------------------------------------------------------
@@ -60,7 +70,7 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
     }
   else
     {
-    this->AddDirectoryInstallRule(os, "", indent);
+    this->AddDirectoryInstallRule(os, "", indent, this->Directories);
     }
 }
 
@@ -69,20 +79,30 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
   const std::string& config,
   Indent const& indent)
 {
-  this->AddDirectoryInstallRule(os, config, indent);
+  std::vector<std::string> dirs;
+  cmGeneratorExpression ge;
+  for(std::vector<std::string>::const_iterator i = this->Directories.begin();
+      i != this->Directories.end(); ++i)
+    {
+    cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
+    cmSystemTools::ExpandListArgument(cge->Evaluate(
+        this->LocalGenerator, config), dirs);
+    }
+  this->AddDirectoryInstallRule(os, config, indent, dirs);
 }
 
 void cmInstallDirectoryGenerator::AddDirectoryInstallRule(
   std::ostream& os,
   const std::string& config,
-  Indent const& indent)
+  Indent const& indent,
+  std::vector<std::string> const& dirs)
 {
   // Write code to install the directories.
   const char* no_rename = 0;
   this->AddInstallRule(os,
                        this->GetDestination(config),
                        cmInstallType_DIRECTORY,
-                       this->Directories,
+                       dirs,
                        this->Optional,
                        this->FilePermissions.c_str(),
                        this->DirPermissions.c_str(),
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 04107e1..9b732d3 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -42,7 +42,8 @@ protected:
                                        Indent const& indent);
   void AddDirectoryInstallRule(std::ostream& os,
                                const std::string& config,
-                               Indent const& indent);
+                               Indent const& indent,
+                               std::vector<std::string> const& dirs);
   cmLocalGenerator* LocalGenerator;
   std::vector<std::string> Directories;
   std::string FilePermissions;
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index aedc89b..dcba9ac 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -551,5 +551,5 @@ install(
   ARCHIVE DESTINATION lib
   INCLUDES DESTINATION include/abs
   )
-install(DIRECTORY include/abs DESTINATION $<1:include>$<0:/wrong>)
+install(DIRECTORY $<1:include/abs>$<0:/wrong> DESTINATION $<1:include>$<0:/wrong>)
 install(EXPORT expAbs NAMESPACE expAbs_ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/expAbs)
diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-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/DIRECTORY-DIRECTORY-bad.cmake b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake
new file mode 100644
index 0000000..ec0436d
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake
@@ -0,0 +1 @@
+install(DIRECTORY $<NOTAGENEX> DESTINATION .)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 043bd1f..2c1b29d 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(DIRECTORY-DIRECTORY-bad)
 run_cmake(DIRECTORY-DESTINATION-bad)
 run_cmake(FILES-DESTINATION-bad)
 run_cmake(TARGETS-DESTINATION-bad)
diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt
index e365076..2737f18 100644
--- a/Tests/SimpleInstall/CMakeLists.txt
+++ b/Tests/SimpleInstall/CMakeLists.txt
@@ -252,7 +252,7 @@ else()
   file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
   file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
   install(
-    DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong>
+    DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong>
     FILE_PERMISSIONS OWNER_READ OWNER_WRITE
     DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                           GROUP_READ GROUP_EXECUTE
@@ -263,7 +263,7 @@ else()
 
   # Alternate directory installation for coverage.
   install(
-    DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
+    DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
     COMPONENT Development
     USE_SOURCE_PERMISSIONS
     PATTERN "CVS" EXCLUDE
diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt
index e365076..2737f18 100644
--- a/Tests/SimpleInstallS2/CMakeLists.txt
+++ b/Tests/SimpleInstallS2/CMakeLists.txt
@@ -252,7 +252,7 @@ else()
   file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/CVS")
   file(REMOVE_RECURSE "${CMAKE_INSTALL_PREFIX}/MyTest/share/TestSubDir/CVS")
   install(
-    DIRECTORY TestSubDir scripts/ DESTINATION $<1:MyTest/share>$<0:/wrong>
+    DIRECTORY TestSubDir $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share>$<0:/wrong>
     FILE_PERMISSIONS OWNER_READ OWNER_WRITE
     DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
                           GROUP_READ GROUP_EXECUTE
@@ -263,7 +263,7 @@ else()
 
   # Alternate directory installation for coverage.
   install(
-    DIRECTORY scripts/ DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
+    DIRECTORY $<1:scripts/>$<0:/wrong> DESTINATION $<1:MyTest/share/alt>$<0:/wrong>
     COMPONENT Development
     USE_SOURCE_PERMISSIONS
     PATTERN "CVS" EXCLUDE

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

Summary of changes:
 Help/command/install.rst                           |    7 ++---
 Help/release/dev/install-DIRECTORY-genex.rst       |    6 +++++
 Source/cmInstallDirectoryGenerator.cxx             |   28 +++++++++++++++++---
 Source/cmInstallDirectoryGenerator.h               |    3 ++-
 Tests/ExportImport/Export/CMakeLists.txt           |    2 +-
 .../DIRECTORY-DIRECTORY-bad-result.txt}            |    0
 .../DIRECTORY-DIRECTORY-bad-stderr.txt}            |    0
 .../RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake |    1 +
 Tests/RunCMake/install/RunCMakeTest.cmake          |    1 +
 Tests/SimpleInstall/CMakeLists.txt                 |    4 +--
 Tests/SimpleInstallS2/CMakeLists.txt               |    4 +--
 11 files changed, 43 insertions(+), 13 deletions(-)
 create mode 100644 Help/release/dev/install-DIRECTORY-genex.rst
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => install/DIRECTORY-DIRECTORY-bad-result.txt} (100%)
 copy Tests/RunCMake/{XcodeProject/XcodeAttributeGenexError-stderr.txt => install/DIRECTORY-DIRECTORY-bad-stderr.txt} (100%)
 create mode 100644 Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list