From e8fdd5f12a379ce91adcb88acdb4354bc271c911 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Apr 2015 12:51:05 -0400 Subject: QtAutogen: Workaround rcc CRCRLF newlines on Windows (#15459) The 'rcc --list' operation may print newlines of the form CRCRLF, so strip any trailing CR characters found on each line. Update the Tests/QtAutogen test to use a resource named in a subdirectory. This causes 'rcc --list' to display a blank line and tests that it is correctly filtered out. --- Source/cmQtAutoGenerators.cxx | 7 +++++++ Tests/QtAutogen/CMakeLists.txt | 2 +- Tests/QtAutogen/autorcc_depends/CMakeLists.txt | 2 +- Tests/QtAutogen/autorcc_depends/res1.qrc.in | 2 +- Tests/QtAutogen/autorcc_depends/res1/input.txt.in | 1 + Tests/QtAutogen/autorcc_depends/res1_input.txt.in | 1 - 6 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 Tests/QtAutogen/autorcc_depends/res1/input.txt.in delete mode 100644 Tests/QtAutogen/autorcc_depends/res1_input.txt.in diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 4cb49c8..a5238f5 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -201,6 +201,13 @@ 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); + } + if (oline.empty()) { // The output of rcc --list contains many empty lines. diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 67e0f7e..f76d11e 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -147,7 +147,7 @@ set(timeformat "%Y%j%H%M%S") file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}") execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change. -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/res1_input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/res1/input.txt") execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends" diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt index 9faf803..fbe71ad 100644 --- a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt +++ b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt @@ -16,7 +16,7 @@ else() endif() configure_file(res1.qrc.in res1.qrc @ONLY) -configure_file(res1_input.txt.in res1_input.txt @ONLY) +configure_file(res1/input.txt.in res1/input.txt @ONLY) add_executable(test_res1 test_res1.cpp diff --git a/Tests/QtAutogen/autorcc_depends/res1.qrc.in b/Tests/QtAutogen/autorcc_depends/res1.qrc.in index cfea618..2a5417b 100644 --- a/Tests/QtAutogen/autorcc_depends/res1.qrc.in +++ b/Tests/QtAutogen/autorcc_depends/res1.qrc.in @@ -1,5 +1,5 @@ - res1_input.txt + res1/input.txt diff --git a/Tests/QtAutogen/autorcc_depends/res1/input.txt.in b/Tests/QtAutogen/autorcc_depends/res1/input.txt.in new file mode 100644 index 0000000..da62762 --- /dev/null +++ b/Tests/QtAutogen/autorcc_depends/res1/input.txt.in @@ -0,0 +1 @@ +Res1 input. diff --git a/Tests/QtAutogen/autorcc_depends/res1_input.txt.in b/Tests/QtAutogen/autorcc_depends/res1_input.txt.in deleted file mode 100644 index da62762..0000000 --- a/Tests/QtAutogen/autorcc_depends/res1_input.txt.in +++ /dev/null @@ -1 +0,0 @@ -Res1 input. -- cgit v0.12