[Cmake-commits] CMake branch, next, updated. v3.2.2-2007-g2dfcc42

Brad King brad.king at kitware.com
Tue Apr 21 09:37:24 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  2dfcc4268d7fe0be7fe4447304b4ee329f88b240 (commit)
       via  258ba82882545d70162c865e56fc024ccd9cd164 (commit)
       via  acd4f01fd81c4303cad37128a75ca390c1a42571 (commit)
      from  2b60bd389f6dd366ba53a2548353ce5495e4c7ec (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=2dfcc4268d7fe0be7fe4447304b4ee329f88b240
commit 2dfcc4268d7fe0be7fe4447304b4ee329f88b240
Merge: 2b60bd3 258ba82
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Apr 21 09:37:22 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Apr 21 09:37:22 2015 -0400

    Merge topic 'autogen-no-rcc-stderr' into next
    
    258ba828 QtAutogen: Process 'rcc --list' stdout and stderr separately (#15523)
    acd4f01f cmQtAutoGenerators: Split CR stripping out to helper function


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=258ba82882545d70162c865e56fc024ccd9cd164
commit 258ba82882545d70162c865e56fc024ccd9cd164
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 20 16:42:19 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Apr 21 09:33:19 2015 -0400

    QtAutogen: Process 'rcc --list' stdout and stderr separately (#15523)
    
    The stderr may have warning messages.  We should not treat these lines
    as resource files.  However, we must still recognize error message lines
    for missing resource files that may be generated.
    
    Extend the QtAutogen test to cover a generated resource as the only one
    listed in a .qrc file.  This causes 'rcc --list' to print a warning to
    stderr that we now intend to ignore.

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 547be6e..644c528 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -197,48 +197,56 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
 
   command.push_back(absFile);
 
-  std::string output;
+  std::string rccStdOut;
+  std::string rccStdErr;
   int retVal = 0;
-  bool result = cmSystemTools::RunSingleCommand(command, &output, &output,
-                                            &retVal, 0,
-                                            cmSystemTools::OUTPUT_NONE);
+  bool result = cmSystemTools::RunSingleCommand(
+    command, &rccStdOut, &rccStdErr,
+    &retVal, 0, cmSystemTools::OUTPUT_NONE);
   if (!result || retVal)
     {
     std::cerr << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath()
-              << " failed:\n" << output << std::endl;
+              << " failed:\n" << rccStdOut << "\n" << rccStdErr << std::endl;
     return std::string();
     }
 
-  std::istringstream ostr(output);
+  {
+  std::istringstream ostr(rccStdOut);
   std::string oline;
   while(std::getline(ostr, oline))
     {
     oline = cmQtAutoGeneratorsStripCR(oline);
-    if (oline.empty())
+    if(!oline.empty())
       {
-      // The output of rcc --list contains many empty lines.
-      continue;
+      qrcEntries.push_back(oline);
       }
-    if (cmHasLiteralPrefix(oline, "RCC: Error in"))
+    }
+  }
+
+  {
+  std::istringstream estr(rccStdErr);
+  std::string eline;
+  while(std::getline(estr, eline))
+    {
+    eline = cmQtAutoGeneratorsStripCR(eline);
+    if (cmHasLiteralPrefix(eline, "RCC: Error in"))
       {
       static std::string searchString = "Cannot find file '";
 
-      std::string::size_type pos = oline.find(searchString);
+      std::string::size_type pos = eline.find(searchString);
       if (pos == std::string::npos)
         {
         std::cerr << "AUTOGEN: error: Rcc lists unparsable output "
-                  << oline << std::endl;
+                  << eline << std::endl;
         return std::string();
         }
       pos += searchString.length();
-      std::string::size_type sz = oline.size() - pos - 1;
-      qrcEntries.push_back(oline.substr(pos, sz));
-      }
-    else
-      {
-      qrcEntries.push_back(oline);
+      std::string::size_type sz = eline.size() - pos - 1;
+      qrcEntries.push_back(eline.substr(pos, sz));
       }
     }
+  }
+
   depends.insert(depends.end(), qrcEntries.begin(), qrcEntries.end());
   return cmJoin(qrcEntries, "@list_sep@");
 }
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index f76d11e..60b44fd 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -63,7 +63,15 @@ add_library(codeeditorLib STATIC codeeditor.cpp)
 
 add_library(privateSlot OBJECT private_slot.cpp)
 
+configure_file(generated_resource.qrc.in generated_resource.qrc @ONLY)
+add_custom_command(
+  OUTPUT generated.txt
+  COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/generated.txt"
+  DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in"
+  )
+
 add_custom_target(generate_moc_input
+  DEPENDS generated.txt
   COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}"
   COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h"
 )
@@ -89,6 +97,7 @@ add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.c
                multiplewidgets.cpp
                xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot>
                test.qrc second_resource.qrc resourcetester.cpp generated.cpp ${debug_srcs}
+               ${CMAKE_CURRENT_BINARY_DIR}/generated_resource.qrc
 )
 set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h")
 
diff --git a/Tests/QtAutogen/generated.txt.in b/Tests/QtAutogen/generated.txt.in
new file mode 100644
index 0000000..77507bb
--- /dev/null
+++ b/Tests/QtAutogen/generated.txt.in
@@ -0,0 +1 @@
+Some generated text file.
diff --git a/Tests/QtAutogen/generated_resource.qrc.in b/Tests/QtAutogen/generated_resource.qrc.in
new file mode 100644
index 0000000..da5fa62
--- /dev/null
+++ b/Tests/QtAutogen/generated_resource.qrc.in
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>generated.txt</file>
+</qresource>
+</RCC>

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=acd4f01fd81c4303cad37128a75ca390c1a42571
commit acd4f01fd81c4303cad37128a75ca390c1a42571
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 20 16:41:37 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Apr 21 09:05:12 2015 -0400

    cmQtAutoGenerators: Split CR stripping out to helper function

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 329f9de..547be6e 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -170,6 +170,17 @@ static std::string getAutogenTargetDir(cmTarget const* target)
   return targetDir;
 }
 
+static std::string cmQtAutoGeneratorsStripCR(std::string const& line)
+{
+  // Strip CR characters rcc may have printed (possibly more than one!).
+  std::string::size_type cr = line.find('\r');
+  if (cr != line.npos)
+    {
+    return line.substr(0, cr);
+    }
+  return line;
+}
+
 std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
                                             cmTarget const* target,
                                             std::vector<std::string>& depends)
@@ -202,13 +213,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
   std::string oline;
   while(std::getline(ostr, oline))
     {
-    // Strip CR characters rcc may have printed (possibly more than one!).
-    std::string::size_type cr = oline.find('\r');
-    if (cr != oline.npos)
-      {
-      oline = oline.substr(0, cr);
-      }
-
+    oline = cmQtAutoGeneratorsStripCR(oline);
     if (oline.empty())
       {
       // The output of rcc --list contains many empty lines.

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

Summary of changes:
 Source/cmQtAutoGenerators.cxx                      |   61 ++++++++++++--------
 Tests/QtAutogen/CMakeLists.txt                     |    9 +++
 Tests/QtAutogen/generated.txt.in                   |    1 +
 ...enerated_file.qrc => generated_resource.qrc.in} |    2 +-
 4 files changed, 48 insertions(+), 25 deletions(-)
 create mode 100644 Tests/QtAutogen/generated.txt.in
 copy Tests/QtAutogen/{not_generated_file.qrc => generated_resource.qrc.in} (68%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list