[Cmake-commits] CMake branch, master, updated. v3.11.3-930-g4d1a643

Kitware Robot kwrobot at kitware.com
Fri Jun 8 09:35:14 EDT 2018


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, master has been updated
       via  4d1a643481e5fb1dd780c18124c1c6bf3d6e0e23 (commit)
       via  7766e57ff0ec4c9e5a38a3736d9cf5c710fa5a76 (commit)
       via  88365838b843ec4452d1f282b5ce23b2b3d6590d (commit)
       via  733d3ac0e8709cb7012d6f7efe2273181c707c7e (commit)
       via  6dad812143ae50df5ed0de4c5c2d433b6d59aea2 (commit)
       via  aeda8fccebd6c6df2478a1a9d87cd0bc0f644190 (commit)
      from  81fc1db0a6f85485276e497030083c28a2812105 (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=4d1a643481e5fb1dd780c18124c1c6bf3d6e0e23
commit 4d1a643481e5fb1dd780c18124c1c6bf3d6e0e23
Merge: 7766e57 aeda8fc
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 8 13:34:07 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Jun 8 09:34:26 2018 -0400

    Merge topic 'CMakePackageConfigHelpers-doc'
    
    aeda8fcceb Help: Package without components should use 'check_required_components' too
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2138


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7766e57ff0ec4c9e5a38a3736d9cf5c710fa5a76
commit 7766e57ff0ec4c9e5a38a3736d9cf5c710fa5a76
Merge: 733d3ac 8836583
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 8 13:33:40 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Jun 8 09:33:46 2018 -0400

    Merge topic 'ninja-win-rsp'
    
    88365838b8 Ninja: Use native slashes to pass rsp files
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2136


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88365838b843ec4452d1f282b5ce23b2b3d6590d
commit 88365838b843ec4452d1f282b5ce23b2b3d6590d
Author:     Matthijs Kool <m.kool at stylecncmachines.com>
AuthorDate: Tue Jun 5 15:21:49 2018 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jun 8 09:31:23 2018 -0400

    Ninja: Use native slashes to pass rsp files
    
    Some tools on Windows (e.g. Embarcadero linkers) can't handle forward
    slashes in paths to rsp files.

diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index a4d3e06..7394188 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -719,9 +719,9 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
     static_cast<int>(cmSystemTools::CalculateCommandLineLengthLimit()) -
     globalGen.GetRuleCmdLength(this->LanguageLinkerDeviceRule());
 
-  const std::string rspfile =
+  const std::string rspfile = this->ConvertToNinjaPath(
     std::string(cmake::GetCMakeFilesDirectoryPostSlash()) +
-    genTarget.GetName() + ".rsp";
+    genTarget.GetName() + ".rsp");
 
   // Gather order-only dependencies.
   cmNinjaDeps orderOnlyDeps;
@@ -1005,9 +1005,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
       globalGen.GetRuleCmdLength(this->LanguageLinkerRule());
   }
 
-  const std::string rspfile =
+  const std::string rspfile = this->ConvertToNinjaPath(
     std::string(cmake::GetCMakeFilesDirectoryPostSlash()) + gt.GetName() +
-    ".rsp";
+    ".rsp");
 
   // Gather order-only dependencies.
   cmNinjaDeps orderOnlyDeps;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=733d3ac0e8709cb7012d6f7efe2273181c707c7e
commit 733d3ac0e8709cb7012d6f7efe2273181c707c7e
Merge: 81fc1db 6dad812
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jun 8 13:28:28 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Jun 8 09:28:43 2018 -0400

    Merge topic 'install-code-script-genex'
    
    6dad812143 install: Teach CODE,SCRIPT modes to evaluate generator expressions
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2113


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6dad812143ae50df5ed0de4c5c2d433b6d59aea2
commit 6dad812143ae50df5ed0de4c5c2d433b6d59aea2
Author:     Jon Chronopoulos <patches at crondog.com>
AuthorDate: Tue May 29 21:37:26 2018 +1000
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 7 13:18:23 2018 -0400

    install: Teach CODE,SCRIPT modes to evaluate generator expressions
    
    Fixes: #15785

diff --git a/Help/command/install.rst b/Help/command/install.rst
index 6cea996..08cbc56 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -427,6 +427,10 @@ example, the code
 
 will print a message during installation.
 
+The contents of ``SCRIPT`` or ``CODE`` may use "generator expressions" with
+the syntax ``$<...>``.  See the :manual:`cmake-generator-expressions(7)`
+manual for available expressions.
+
 Installing Exports
 ^^^^^^^^^^^^^^^^^^
 
diff --git a/Help/release/dev/install-code-script-genex.rst b/Help/release/dev/install-code-script-genex.rst
new file mode 100644
index 0000000..6532e7b
--- /dev/null
+++ b/Help/release/dev/install-code-script-genex.rst
@@ -0,0 +1,5 @@
+install-code-script-genex
+-------------------------
+
+* The :command:`install(CODE)` and :command:`install(SCRIPT)` commands
+  learned to support generator expressions.
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index f7e6e44..3a90f4c 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -2,6 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmInstallScriptGenerator.h"
 
+#include "cmGeneratorExpression.h"
 #include "cmScriptGenerator.h"
 
 #include <ostream>
@@ -16,24 +17,47 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script,
   , Script(script)
   , Code(code)
 {
+  // We need per-config actions if the script has generator expressions.
+  if (cmGeneratorExpression::Find(Script) != std::string::npos) {
+    this->ActionsPerConfig = true;
+  }
 }
 
 cmInstallScriptGenerator::~cmInstallScriptGenerator()
 {
 }
 
-void cmInstallScriptGenerator::GenerateScript(std::ostream& os)
+void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
 {
-  Indent indent;
-  std::string component_test =
-    this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
-  os << indent << "if(" << component_test << ")\n";
+  this->LocalGenerator = lg;
+}
 
+void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os,
+                                                    Indent indent,
+                                                    std::string const& script)
+{
   if (this->Code) {
-    os << indent.Next() << this->Script << "\n";
+    os << indent.Next() << script << "\n";
+  } else {
+    os << indent.Next() << "include(\"" << script << "\")\n";
+  }
+}
+
+void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os,
+                                                     Indent indent)
+{
+  if (this->ActionsPerConfig) {
+    this->cmInstallGenerator::GenerateScriptActions(os, indent);
   } else {
-    os << indent.Next() << "include(\"" << this->Script << "\")\n";
+    this->AddScriptInstallRule(os, indent, this->Script);
   }
+}
 
-  os << indent << "endif()\n\n";
+void cmInstallScriptGenerator::GenerateScriptForConfig(
+  std::ostream& os, const std::string& config, Indent indent)
+{
+  cmGeneratorExpression ge;
+  std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(this->Script);
+  this->AddScriptInstallRule(os, indent,
+                             cge->Evaluate(this->LocalGenerator, config));
 }
diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h
index fe0f7c6..534bc1d 100644
--- a/Source/cmInstallScriptGenerator.h
+++ b/Source/cmInstallScriptGenerator.h
@@ -6,10 +6,13 @@
 #include "cmConfigure.h" // IWYU pragma: keep
 
 #include "cmInstallGenerator.h"
+#include "cmScriptGenerator.h"
 
 #include <iosfwd>
 #include <string>
 
+class cmLocalGenerator;
+
 /** \class cmInstallScriptGenerator
  * \brief Generate target installation rules.
  */
@@ -20,10 +23,18 @@ public:
                            const char* component, bool exclude_from_all);
   ~cmInstallScriptGenerator() override;
 
+  void Compute(cmLocalGenerator* lg) override;
+
 protected:
-  void GenerateScript(std::ostream& os) override;
+  void GenerateScriptActions(std::ostream& os, Indent indent) override;
+  void GenerateScriptForConfig(std::ostream& os, const std::string& config,
+                               Indent indent) override;
+  void AddScriptInstallRule(std::ostream& os, Indent indent,
+                            std::string const& script);
+
   std::string Script;
   bool Code;
+  cmLocalGenerator* LocalGenerator;
 };
 
 #endif
diff --git a/Tests/RunCMake/install/CODE-genex-bad-result.txt b/Tests/RunCMake/install/CODE-genex-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/CODE-genex-bad-stderr.txt b/Tests/RunCMake/install/CODE-genex-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex-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/CODE-genex-bad.cmake b/Tests/RunCMake/install/CODE-genex-bad.cmake
new file mode 100644
index 0000000..1663b39
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex-bad.cmake
@@ -0,0 +1 @@
+install(CODE "message(\"$<NOTAGENEX>\")")
diff --git a/Tests/RunCMake/install/CODE-genex-check.cmake b/Tests/RunCMake/install/CODE-genex-check.cmake
new file mode 100644
index 0000000..422c532
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex-check.cmake
@@ -0,0 +1,7 @@
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+  OUTPUT_VARIABLE out ERROR_VARIABLE err)
+if(NOT out MATCHES "-- Install configuration: .*-- codegenexlib")
+  string(REGEX REPLACE "\n" "\n  " out "  ${out}")
+  string(APPEND RunCMake_TEST_FAILED
+      "\"-- codegenexlib\" was not found:\n${out}")
+endif()
diff --git a/Tests/RunCMake/install/CODE-genex.cmake b/Tests/RunCMake/install/CODE-genex.cmake
new file mode 100644
index 0000000..3b8513d
--- /dev/null
+++ b/Tests/RunCMake/install/CODE-genex.cmake
@@ -0,0 +1,2 @@
+add_library( codegenexlib INTERFACE )
+install(CODE "message( STATUS \"$<TARGET_PROPERTY:codegenexlib,NAME>\")")
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index f004ce9..f0c02d8 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -65,6 +65,8 @@ run_cmake(CMP0062-NEW)
 run_cmake(CMP0062-WARN)
 run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all)
 run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc)
+run_cmake(CODE-genex)
+run_cmake(CODE-genex-bad)
 
 if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")
   run_install_test(FILES-TARGET_OBJECTS)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aeda8fccebd6c6df2478a1a9d87cd0bc0f644190
commit aeda8fccebd6c6df2478a1a9d87cd0bc0f644190
Author:     Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Thu Jun 7 13:28:23 2018 +0300
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 7 10:41:45 2018 -0400

    Help: Package without components should use 'check_required_components' too
    
    Macro 'check_required_components' should be called even if there are no
    components provided by package.  This will make sure error is reported
    in next cases:
    
        find_package(Foo CONFIG REQUIRED oops) # 'oops' treated as component
        find_package(Foo CONFIG REQUIRED COMPONENTS foo) # no components expected

diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index e37f34f..790d408 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -102,13 +102,15 @@
 # into the ``FooConfig.cmake`` file.
 #
 # ``check_required_components(<package_name>)`` should be called at the end of
-# the ``FooConfig.cmake`` file if the package supports components.  This macro
-# checks whether all requested, non-optional components have been found, and if
-# this is not the case, sets the ``Foo_FOUND`` variable to ``FALSE``, so that
-# the package is considered to be not found.  It does that by testing the
-# ``Foo_<Component>_FOUND`` variables for all requested required components.
-# When using the ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is
-# not generated into the ``FooConfig.cmake`` file.
+# the ``FooConfig.cmake`` file. This macro checks whether all requested,
+# non-optional components have been found, and if this is not the case, sets
+# the ``Foo_FOUND`` variable to ``FALSE``, so that the package is considered to
+# be not found.  It does that by testing the ``Foo_<Component>_FOUND``
+# variables for all requested required components.  This macro should be
+# called even if the package doesn't provide any components to make sure
+# users are not specifying components erroneously.  When using the
+# ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is not generated
+# into the ``FooConfig.cmake`` file.
 #
 # For an example see below the documentation for
 # :command:`write_basic_package_version_file()`.

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

Summary of changes:
 Help/command/install.rst                           |    4 ++
 Help/release/dev/install-code-script-genex.rst     |    5 +++
 Modules/CMakePackageConfigHelpers.cmake            |   16 ++++----
 Source/cmInstallScriptGenerator.cxx                |   40 ++++++++++++++++----
 Source/cmInstallScriptGenerator.h                  |   13 ++++++-
 Source/cmNinjaNormalTargetGenerator.cxx            |    8 ++--
 .../CODE-genex-bad-result.txt}                     |    0
 .../CODE-genex-bad-stderr.txt}                     |    0
 Tests/RunCMake/install/CODE-genex-bad.cmake        |    1 +
 Tests/RunCMake/install/CODE-genex-check.cmake      |    7 ++++
 Tests/RunCMake/install/CODE-genex.cmake            |    2 +
 Tests/RunCMake/install/RunCMakeTest.cmake          |    2 +
 12 files changed, 78 insertions(+), 20 deletions(-)
 create mode 100644 Help/release/dev/install-code-script-genex.rst
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => install/CODE-genex-bad-result.txt} (100%)
 copy Tests/RunCMake/{XcodeProject/XcodeAttributeGenexError-stderr.txt => install/CODE-genex-bad-stderr.txt} (100%)
 create mode 100644 Tests/RunCMake/install/CODE-genex-bad.cmake
 create mode 100644 Tests/RunCMake/install/CODE-genex-check.cmake
 create mode 100644 Tests/RunCMake/install/CODE-genex.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list