diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 69 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.h | 3 | ||||
-rw-r--r-- | Source/cmServerProtocol.cxx | 4 | ||||
-rw-r--r-- | Source/cmStringCommand.cxx | 27 | ||||
-rw-r--r-- | Source/cmStringCommand.h | 1 |
5 files changed, 81 insertions, 23 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index bdddfc2..1fe07ce 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1454,31 +1454,62 @@ bool cmQtAutoGenerators::MocGenerateFile( bool cmQtAutoGenerators::UicFindIncludedFile(std::string& absFile, const std::string& sourceFile, - const std::string& includeString) + const std::string& searchPath, + const std::string& searchFile) { bool success = false; - // Search in vicinity of the source + std::vector<std::string> testFiles; + // Collect search paths list { - std::string testPath = SubDirPrefix(sourceFile); - testPath += includeString; - if (cmsys::SystemTools::FileExists(testPath.c_str())) { - absFile = cmsys::SystemTools::GetRealPath(testPath); + const std::string searchFileFull = searchPath + searchFile; + // Vicinity of the source + { + const std::string sourcePath = SubDirPrefix(sourceFile); + testFiles.push_back(sourcePath + searchFile); + if (!searchPath.empty()) { + testFiles.push_back(sourcePath + searchFileFull); + } + } + // AUTOUIC search paths + if (!this->UicSearchPaths.empty()) { + for (std::vector<std::string>::const_iterator iit = + this->UicSearchPaths.begin(); + iit != this->UicSearchPaths.end(); ++iit) { + testFiles.push_back(*iit + "/" + searchFile); + } + if (!searchPath.empty()) { + for (std::vector<std::string>::const_iterator iit = + this->UicSearchPaths.begin(); + iit != this->UicSearchPaths.end(); ++iit) { + testFiles.push_back(*iit + "/" + searchFileFull); + } + } + } + } + + // Search for the .ui file! + for (std::vector<std::string>::const_iterator iit = testFiles.begin(); + iit != testFiles.end(); ++iit) { + const std::string& testFile = *iit; + if (cmsys::SystemTools::FileExists(testFile.c_str())) { + absFile = cmsys::SystemTools::GetRealPath(testFile); success = true; + break; } } - // Search in include directories + + // Log error if (!success) { - for (std::vector<std::string>::const_iterator iit = - this->UicSearchPaths.begin(); - iit != this->UicSearchPaths.end(); ++iit) { - const std::string fullPath = ((*iit) + '/' + includeString); - if (cmsys::SystemTools::FileExists(fullPath.c_str())) { - absFile = cmsys::SystemTools::GetRealPath(fullPath); - success = true; - break; - } + std::ostringstream ost; + ost << "AutoUic: Error: " << Quoted(sourceFile) << "\n"; + ost << "Could not find " << Quoted(searchFile) << " in\n"; + for (std::vector<std::string>::const_iterator iit = testFiles.begin(); + iit != testFiles.end(); ++iit) { + ost << " " << Quoted(*iit) << "\n"; } + this->LogError(ost.str()); } + return success; } @@ -1508,16 +1539,14 @@ bool cmQtAutoGenerators::UicGenerateAll( const std::string uiBasePath = SubDirPrefix(*uit); const std::string uiBaseName = cmsys::SystemTools::GetFilenameWithoutLastExtension(*uit).substr(3); - const std::string searchFileName = uiBasePath + uiBaseName + ".ui"; + const std::string uiFileName = uiBaseName + ".ui"; std::string uiInputFile; - if (UicFindIncludedFile(uiInputFile, source, searchFileName)) { + if (UicFindIncludedFile(uiInputFile, source, uiBasePath, uiFileName)) { std::string uiOutputFile = uiBasePath + "ui_" + uiBaseName + ".h"; cmSystemTools::ReplaceString(uiOutputFile, "..", "__"); uiGenMap[uiInputFile] = uiOutputFile; testMap[uiInputFile] = uiOutputFile; } else { - this->LogError("AutoUic: Error: " + Quoted(sit->first) + - "\nCould not find " + Quoted(searchFileName)); return false; } } diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index b525364..337aa17 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -112,7 +112,8 @@ private: // -- Uic file generation bool UicFindIncludedFile(std::string& absFile, const std::string& sourceFile, - const std::string& includeString); + const std::string& searchPath, + const std::string& searchFile); bool UicGenerateAll( const std::map<std::string, std::vector<std::string> >& includedUis); bool UicGenerateFile(const std::string& realName, diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index b371e9e..baaf11a 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -747,14 +747,14 @@ static Json::Value DumpBacktrace(const cmListFileBacktrace& backtrace) if (!backtraceCopy.Top().Name.empty()) { entry[kNAME_KEY] = backtraceCopy.Top().Name; } - result.append(std::move(entry)); + result.append(entry); backtraceCopy = backtraceCopy.Pop(); } return result; } static void DumpBacktraceRange(Json::Value& result, const std::string& type, - const cmBacktraceRange& range) + cmBacktraceRange range) { for (const auto& bt : range) { Json::Value obj = Json::objectValue; diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 5a6cf48..b07eae1 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -62,6 +62,9 @@ bool cmStringCommand::InitialPass(std::vector<std::string> const& args, if (subCommand == "APPEND") { return this->HandleAppendCommand(args); } + if (subCommand == "PREPEND") { + return this->HandlePrependCommand(args); + } if (subCommand == "CONCAT") { return this->HandleConcatCommand(args); } @@ -643,6 +646,30 @@ bool cmStringCommand::HandleAppendCommand(std::vector<std::string> const& args) return true; } +bool cmStringCommand::HandlePrependCommand( + std::vector<std::string> const& args) +{ + if (args.size() < 2) { + this->SetError("sub-command PREPEND requires at least one argument."); + return false; + } + + // Skip if nothing to prepend. + if (args.size() < 3) { + return true; + } + + const std::string& variable = args[1]; + + std::string value = cmJoin(cmMakeRange(args).advance(2), std::string()); + const char* oldValue = this->Makefile->GetDefinition(variable); + if (oldValue) { + value += oldValue; + } + this->Makefile->AddDefinition(variable, value.c_str()); + return true; +} + bool cmStringCommand::HandleConcatCommand(std::vector<std::string> const& args) { if (args.size() < 2) { diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 88015ad..0dded15 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -46,6 +46,7 @@ protected: bool HandleLengthCommand(std::vector<std::string> const& args); bool HandleSubstringCommand(std::vector<std::string> const& args); bool HandleAppendCommand(std::vector<std::string> const& args); + bool HandlePrependCommand(std::vector<std::string> const& args); bool HandleConcatCommand(std::vector<std::string> const& args); bool HandleStripCommand(std::vector<std::string> const& args); bool HandleRandomCommand(std::vector<std::string> const& args); |