diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmAuxSourceDirectoryCommand.cxx | 12 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 71 |
3 files changed, 44 insertions, 41 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3c36419..51a0fff 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160930) +set(CMake_VERSION_PATCH 20161003) #set(CMake_VERSION_RC 1) diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index fed4d5b..6655911 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -32,6 +32,8 @@ bool cmAuxSourceDirectoryCommand::InitialPass( sourceListValue = def; } + std::vector<std::string> files; + // Load all the files in the directory cmsys::Directory dir; if (dir.Load(tdir.c_str())) { @@ -55,14 +57,16 @@ bool cmAuxSourceDirectoryCommand::InitialPass( // depends can be done cmSourceFile* sf = this->Makefile->GetOrCreateSource(fullname); sf->SetProperty("ABSTRACT", "0"); - if (!sourceListValue.empty()) { - sourceListValue += ";"; - } - sourceListValue += fullname; + files.push_back(fullname); } } } } + std::sort(files.begin(), files.end()); + if (!sourceListValue.empty()) { + sourceListValue += ";"; + } + sourceListValue += cmJoin(files, ";"); this->Makefile->AddDefinition(args[1], sourceListValue.c_str()); return true; } diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 71687ac..5246a67 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -434,13 +434,15 @@ static std::string ReadAll(const std::string& filename) return stream.str(); } -static std::string ListQt5RccInputs(cmSourceFile* sf, - cmGeneratorTarget const* target, - std::vector<std::string>& depends) +/// @brief Reads the resource files list from from a .qrc file - Qt5 version +/// @return True if the .qrc file was successfully parsed +static bool ListQt5RccInputs(cmSourceFile* sf, cmGeneratorTarget const* target, + std::vector<std::string>& depends) { std::string rccCommand = GetRccExecutable(target); bool hasDashDashList = false; + // Read rcc features { std::vector<std::string> command; command.push_back(rccCommand); @@ -456,15 +458,12 @@ static std::string ListQt5RccInputs(cmSourceFile* sf, hasDashDashList = true; } } - - std::vector<std::string> qrcEntries; - + // Run rcc list command std::vector<std::string> command; command.push_back(rccCommand); command.push_back(hasDashDashList ? "--list" : "-list"); std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath()); - command.push_back(absFile); std::string rccStdOut; @@ -479,17 +478,18 @@ static std::string ListQt5RccInputs(cmSourceFile* sf, << " failed:\n" << rccStdOut << "\n" << rccStdErr << std::endl; - std::cerr << err.str(); - return std::string(); + cmSystemTools::Error(err.str().c_str()); + return false; } + // Parse rcc list output { std::istringstream ostr(rccStdOut); std::string oline; while (std::getline(ostr, oline)) { oline = cmQtAutoGeneratorsStripCR(oline); if (!oline.empty()) { - qrcEntries.push_back(oline); + depends.push_back(oline); } } } @@ -507,30 +507,28 @@ static std::string ListQt5RccInputs(cmSourceFile* sf, std::ostringstream err; err << "AUTOGEN: error: Rcc lists unparsable output " << eline << std::endl; - std::cerr << err.str(); - return std::string(); + cmSystemTools::Error(err.str().c_str()); + return false; } pos += searchString.length(); std::string::size_type sz = eline.size() - pos - 1; - qrcEntries.push_back(eline.substr(pos, sz)); + depends.push_back(eline.substr(pos, sz)); } } } - depends.insert(depends.end(), qrcEntries.begin(), qrcEntries.end()); - return cmJoin(qrcEntries, "@list_sep@"); + return true; } -static std::string ListQt4RccInputs(cmSourceFile* sf, - std::vector<std::string>& depends) +/// @brief Reads the resource files list from from a .qrc file - Qt4 version +/// @return True if the .qrc file was successfully parsed +static bool ListQt4RccInputs(cmSourceFile* sf, + std::vector<std::string>& depends) { const std::string qrcContents = ReadAll(sf->GetFullPath()); cmsys::RegularExpression fileMatchRegex("(<file[^<]+)"); - std::string entriesList; - const char* sep = ""; - size_t offset = 0; while (fileMatchRegex.find(qrcContents.c_str() + offset)) { std::string qrcEntry = fileMatchRegex.match(1); @@ -547,12 +545,21 @@ static std::string ListQt4RccInputs(cmSourceFile* sf, qrcEntry = sf->GetLocation().GetDirectory() + "/" + qrcEntry; } - entriesList += sep; - entriesList += qrcEntry; - sep = "@list_sep@"; depends.push_back(qrcEntry); } - return entriesList; + return true; +} + +/// @brief Reads the resource files list from from a .qrc file +/// @return True if the rcc file was successfully parsed +static bool ListQtRccInputs(const std::string& qtMajorVersion, + cmSourceFile* sf, cmGeneratorTarget const* target, + std::vector<std::string>& depends) +{ + if (qtMajorVersion == "5") { + return ListQt5RccInputs(sf, target, depends); + } + return ListQt4RccInputs(sf, depends); } static void SetupAutoRccTarget(cmGeneratorTarget const* target) @@ -615,16 +622,12 @@ static void SetupAutoRccTarget(cmGeneratorTarget const* target) } optionSep = ";"; - std::vector<std::string> depends; - std::string entriesList; if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) { - if (qtMajorVersion == "5") { - entriesList = ListQt5RccInputs(sf, target, depends); + std::vector<std::string> depends; + if (ListQtRccInputs(qtMajorVersion, sf, target, depends)) { + entriesList = cmJoin(depends, "@list_sep@"); } else { - entriesList = ListQt4RccInputs(sf, depends); - } - if (entriesList.empty()) { return; } } @@ -778,11 +781,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( rcc_output.push_back(rcc_output_file); } if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) { - if (qtMajorVersion == "5") { - ListQt5RccInputs(sf, target, depends); - } else { - ListQt4RccInputs(sf, depends); - } + ListQtRccInputs(qtMajorVersion, sf, target, depends); #if defined(_WIN32) && !defined(__CYGWIN__) // Cannot use PRE_BUILD because the resource files themselves // may not be sources within the target so VS may not know the |