diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 42 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 6 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio11Generator.cxx | 8 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio71Generator.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio8Generator.h | 6 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio9Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 12 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 270 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.h | 5 |
14 files changed, 247 insertions, 131 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a1620b2..489dc3c 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 5) -set(CMake_VERSION_PATCH 20160426) +set(CMake_VERSION_PATCH 20160428) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 1f17f8f..12e2eee 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -481,9 +481,46 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( } } +std::map<const cmSourceFile *, std::string> +cmGhsMultiTargetGenerator::GetObjectNames( + const std::vector<cmSourceFile *> &objectSources) +{ + bool found_duplicate = false; + std::set<std::string> filenames; + for(std::vector<cmSourceFile *>::const_iterator + sf = objectSources.begin(); sf != objectSources.end(); ++sf) + { + const std::string filename = + cmSystemTools::GetFilenameName((*sf)->GetFullPath()); + const std::string lower_filename = cmSystemTools::LowerCase(filename); + if (filenames.end() != filenames.find(lower_filename)) + { + found_duplicate = true; + } + filenames.insert(lower_filename); + } + + std::map<const cmSourceFile *, std::string> objectNames; + if (found_duplicate) + { + for(std::vector<cmSourceFile *>::const_iterator + sf = objectSources.begin(); sf != objectSources.end(); ++sf) + { + std::string full_filename = (*sf)->GetFullPath(); + cmsys::SystemTools::ReplaceString(full_filename, ":/", "_"); + cmsys::SystemTools::ReplaceString(full_filename, "/", "_"); + objectNames[*sf] = full_filename; + } + } + + return objectNames; +} + void cmGhsMultiTargetGenerator::WriteSources( std::vector<cmSourceFile *> const &objectSources) { + std::map<const cmSourceFile *, std::string> objectNames = + cmGhsMultiTargetGenerator::GetObjectNames(objectSources); for (std::vector<cmSourceFile *>::const_iterator si = objectSources.begin(); si != objectSources.end(); ++si) { @@ -515,6 +552,11 @@ void cmGhsMultiTargetGenerator::WriteSources( "bsp" != (*si)->GetExtension()) { this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si)); + if (objectNames.end() != objectNames.find(*si)) + { + *this->FolderBuildStreams[sgPath] << " -o \"" << + objectNames.find(*si)->second << ".o\"" << std::endl; + } this->WriteObjectDir(this->FolderBuildStreams[sgPath], this->AbsBuildFilePath + sgPath); diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index e85e412..3a13600 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -88,6 +88,8 @@ private: WriteCustomCommandsHelper(std::vector<cmCustomCommand> const &commandsSet, cmTarget::CustomCommandType commandType); void WriteSources(std::vector<cmSourceFile *> const &objectSources); + static std::map<const cmSourceFile *, std::string> + GetObjectNames(const std::vector<cmSourceFile *> &objectSources); static void WriteObjectLangOverride(cmGeneratedFileStream *fileStream, cmSourceFile *sourceFile); static void WriteObjectDir(cmGeneratedFileStream *fileStream, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index c49008d..c24e7f5 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -609,12 +609,6 @@ void cmGlobalVisualStudio10Generator::PathTooLong( } //---------------------------------------------------------------------------- -bool cmGlobalVisualStudio10Generator::UseFolderProperty() -{ - return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty(); -} - -//---------------------------------------------------------------------------- bool cmGlobalVisualStudio10Generator::IsNsightTegra() const { return !this->NsightTegraVersion.empty(); diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 6bf4740..8723fd1 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -56,9 +56,6 @@ public: cmMakefile *, bool optional); virtual void WriteSLNHeader(std::ostream& fout); - /** Is the installed VS an Express edition? */ - bool IsExpressEdition() const { return this->ExpressEdition; } - /** Generating for Nsight Tegra VS plugin? */ bool IsNsightTegra() const; std::string GetNsightTegraVersion() const; @@ -129,9 +126,6 @@ protected: bool SystemIsWindowsCE; bool SystemIsWindowsPhone; bool SystemIsWindowsStore; - bool ExpressEdition; - - bool UseFolderProperty(); private: class Factory; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 9522f6e..9b00357 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -239,10 +239,10 @@ void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) //---------------------------------------------------------------------------- bool cmGlobalVisualStudio11Generator::UseFolderProperty() { - // Intentionally skip over the parent class implementation and call the - // grand-parent class's implementation. Folders are not supported by the - // Express editions in VS10 and earlier, but they are in VS11 Express. - return cmGlobalVisualStudio8Generator::UseFolderProperty(); + // Intentionally skip up to the top-level class implementation. + // Folders are not supported by the Express editions in VS10 and earlier, + // but they are in VS11 Express and above. + return cmGlobalGenerator::UseFolderProperty(); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 5035fda..d20ffbc 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -75,6 +75,9 @@ protected: const std::set<std::string>& depends); virtual void WriteSLNHeader(std::ostream& fout); + // Folders are not supported by VS 7.1. + virtual bool UseFolderProperty() { return false; } + std::string ProjectConfigurationSectionName; }; #endif diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 3abff6c..5c50530 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -103,6 +103,10 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(cmake* cm, this->Name = name; this->ExtraFlagTable = this->GetExtraFlagTableVS8(); this->Version = VS8; + std::string vc8Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\8.0\\Setup\\VC;" + "ProductDir", vc8Express, cmSystemTools::KeyWOW64_32); } //---------------------------------------------------------------------------- @@ -190,6 +194,12 @@ void cmGlobalVisualStudio8Generator::Configure() } //---------------------------------------------------------------------------- +bool cmGlobalVisualStudio8Generator::UseFolderProperty() +{ + return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty(); +} + +//---------------------------------------------------------------------------- std::string cmGlobalVisualStudio8Generator::GetUserMacrosDirectory() { // Some VS8 sp0 versions cannot run macros. diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index b3093cc..6eb8450 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -66,6 +66,9 @@ public: virtual bool TargetsWindowsCE() const { return !this->WindowsCEVersion.empty(); } + /** Is the installed VS an Express edition? */ + bool IsExpressEdition() const { return this->ExpressEdition; } + protected: virtual void AddExtraIDETargets(); virtual const char* GetIDEVersion() { return "8.0"; } @@ -94,8 +97,11 @@ protected: const char* path, const cmGeneratorTarget *t); + bool UseFolderProperty(); + std::string Name; std::string WindowsCEVersion; + bool ExpressEdition; private: class Factory; diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 884f754..da6ffae 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -104,6 +104,10 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(cmake* cm, : cmGlobalVisualStudio8Generator(cm, name, platformName) { this->Version = VS9; + std::string vc9Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0\\Setup\\VC;" + "ProductDir", vc9Express, cmSystemTools::KeyWOW64_32); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 04146fb..9817b09 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -92,7 +92,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() // // Organize in the "predefined targets" folder: // - if (this->UseFolderProperty() && this->GetVersion() > VS71) + if (this->UseFolderProperty()) { allBuild->SetProperty("FOLDER", this->GetPredefinedTargetsFolder()); } diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index ea9ea7c..9b2362a 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -592,8 +592,10 @@ static std::string ListQt5RccInputs(cmSourceFile* sf, &retVal, 0, cmSystemTools::OUTPUT_NONE); if (!result || retVal) { - std::cerr << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath() - << " failed:\n" << rccStdOut << "\n" << rccStdErr << std::endl; + std::stringstream err; + err << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath() + << " failed:\n" << rccStdOut << "\n" << rccStdErr << std::endl; + std::cerr << err.str(); return std::string(); } @@ -623,8 +625,10 @@ static std::string ListQt5RccInputs(cmSourceFile* sf, std::string::size_type pos = eline.find(searchString); if (pos == std::string::npos) { - std::cerr << "AUTOGEN: error: Rcc lists unparsable output " - << eline << std::endl; + std::stringstream err; + err << "AUTOGEN: error: Rcc lists unparsable output " + << eline << std::endl; + std::cerr << err.str(); return std::string(); } pos += searchString.length(); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 3c6db2d..07fc239 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -549,7 +549,9 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) const std::string &absFilename = *it; if (this->Verbose) { - std::cout << "AUTOGEN: Checking " << absFilename << std::endl; + std::stringstream err; + err << "AUTOGEN: Checking " << absFilename << std::endl; + this->LogInfo(err.str()); } if (this->RelaxedMode) { @@ -577,7 +579,9 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) const std::string &absFilename = *it; if (this->Verbose) { - std::cout << "AUTOGEN: Checking " << absFilename << std::endl; + std::stringstream err; + err << "AUTOGEN: Checking " << absFilename << std::endl; + this->LogInfo(err.str()); } this->ParseForUic(absFilename, includedUis); } @@ -607,17 +611,20 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) if (this->RunMocFailed) { - std::cerr << "moc failed..." << std::endl; + std::stringstream err; err << "moc failed..." << std::endl; + this->LogError(err.str()); return false; } if (this->RunUicFailed) { - std::cerr << "uic failed..." << std::endl; + std::stringstream err; err << "uic failed..." << std::endl; + this->LogError(err.str()); return false; } if (this->RunRccFailed) { - std::cerr << "rcc failed..." << std::endl; + std::stringstream err; err << "rcc failed..." << std::endl; + this->LogError(err.str()); return false; } @@ -637,8 +644,10 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, const std::string contentsString = ReadAll(absFilename); if (contentsString.empty()) { - std::cerr << "AUTOGEN: warning: " << absFilename << ": file is empty\n" - << std::endl; + std::stringstream err; + err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" + << std::endl; + this->LogError(err.str()); return; } this->ParseForUic(absFilename, contentsString, includedUis); @@ -670,7 +679,6 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, do { const std::string currentMoc = mocIncludeRegExp.match(1); - //std::cout << "found moc include: " << currentMoc << std::endl; std::string basename = cmsys::SystemTools:: GetFilenameWithoutLastExtension(currentMoc); @@ -703,20 +711,21 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, } else { - std::cerr << "AUTOGEN: error: " << absFilename << ": The file " - << "includes the moc file \"" << currentMoc << "\", " - << "but could not find header \"" << basename - << '{' << this->JoinExts(headerExtensions) << "}\" "; + std::stringstream err; + err << "AUTOGEN: error: " << absFilename << ": The file " + << "includes the moc file \"" << currentMoc << "\", " + << "but could not find header \"" << basename + << '{' << this->JoinExts(headerExtensions) << "}\" "; if (mocSubDir.empty()) { - std::cerr << "in " << absPath << "\n" << std::endl; + err << "in " << absPath << "\n" << std::endl; } else { - std::cerr << "neither in " << absPath - << " nor in " << mocSubDir << "\n" << std::endl; + err << "neither in " << absPath + << " nor in " << mocSubDir << "\n" << std::endl; } - + this->LogError(err.str()); ::exit(EXIT_FAILURE); } } @@ -734,34 +743,40 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, fileToMoc = headerToMoc; if ((requiresMoc==false) &&(basename==scannedFileBasename)) { - std::cerr << "AUTOGEN: warning: " << absFilename << ": The file " - "includes the moc file \"" << currentMoc << - "\", but does not contain a " << macroName - << " macro. Running moc on " - << "\"" << headerToMoc << "\" ! Include \"moc_" - << basename << ".cpp\" for a compatibility with " - "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" - << std::endl; + std::stringstream err; + err << "AUTOGEN: warning: " << absFilename << ": The file " + "includes the moc file \"" << currentMoc << + "\", but does not contain a " << macroName + << " macro. Running moc on " + << "\"" << headerToMoc << "\" ! Include \"moc_" + << basename << ".cpp\" for a compatibility with " + "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" + << std::endl; + this->LogError(err.str()); } else { - std::cerr << "AUTOGEN: warning: " << absFilename << ": The file " - "includes the moc file \"" << currentMoc << - "\" instead of \"moc_" << basename << ".cpp\". " - "Running moc on " - << "\"" << headerToMoc << "\" ! Include \"moc_" - << basename << ".cpp\" for compatibility with " - "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" - << std::endl; + std::stringstream err; + err << "AUTOGEN: warning: " << absFilename << ": The file " + "includes the moc file \"" << currentMoc << + "\" instead of \"moc_" << basename << ".cpp\". " + "Running moc on " + << "\"" << headerToMoc << "\" ! Include \"moc_" + << basename << ".cpp\" for compatibility with " + "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" + << std::endl; + this->LogError(err.str()); } } else { - std::cerr <<"AUTOGEN: error: " << absFilename << ": The file " - "includes the moc file \"" << currentMoc << - "\", which seems to be the moc file from a different " - "source file. CMake also could not find a matching " - "header.\n" << std::endl; + std::stringstream err; + err << "AUTOGEN: error: " << absFilename << ": The file " + "includes the moc file \"" << currentMoc << + "\", which seems to be the moc file from a different " + "source file. CMake also could not find a matching " + "header.\n" << std::endl; + this->LogError(err.str()); ::exit(EXIT_FAILURE); } } @@ -785,27 +800,33 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, if (mocUnderscoreIncluded == true) { // this is for KDE4 compatibility: - std::cerr << "AUTOGEN: warning: " << absFilename << ": The file " - << "contains a " << macroName << " macro, but does not " - "include " - << "\"" << scannedFileBasename << ".moc\", but instead " - "includes " - << "\"" << ownMocUnderscoreFile << "\". Running moc on " - << "\"" << absFilename << "\" ! Better include \"" - << scannedFileBasename << ".moc\" for compatibility with " - "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" - << std::endl; + std::stringstream err; + err << "AUTOGEN: warning: " << absFilename << ": The file " + << "contains a " << macroName << " macro, but does not " + "include " + << "\"" << scannedFileBasename << ".moc\", but instead " + "includes " + << "\"" << ownMocUnderscoreFile << "\". Running moc on " + << "\"" << absFilename << "\" ! Better include \"" + << scannedFileBasename << ".moc\" for compatibility with " + "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" + << std::endl; + this->LogError(err.str()); + includedMocs[absFilename] = ownMocUnderscoreFile; includedMocs.erase(ownMocHeaderFile); } else { // otherwise always error out since it will not compile: - std::cerr << "AUTOGEN: error: " << absFilename << ": The file " - << "contains a " << macroName << " macro, but does not " - "include " - << "\"" << scannedFileBasename << ".moc\" !\n" - << std::endl; + std::stringstream err; + err << "AUTOGEN: error: " << absFilename << ": The file " + << "contains a " << macroName << " macro, but does not " + "include " + << "\"" << scannedFileBasename << ".moc\" !\n" + << std::endl; + this->LogError(err.str()); + ::exit(EXIT_FAILURE); } } @@ -825,8 +846,10 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, const std::string contentsString = ReadAll(absFilename); if (contentsString.empty()) { - std::cerr << "AUTOGEN: warning: " << absFilename << ": file is empty\n" - << std::endl; + std::stringstream err; + err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" + << std::endl; + this->LogError(err.str()); return; } this->ParseForUic(absFilename, contentsString, includedUis); @@ -878,20 +901,21 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, } else { - std::cerr << "AUTOGEN: error: " << absFilename << " The file " - << "includes the moc file \"" << currentMoc << "\", " - << "but could not find header \"" << basename - << '{' << this->JoinExts(headerExtensions) << "}\" "; + std::stringstream err; + err << "AUTOGEN: error: " << absFilename << " The file " + << "includes the moc file \"" << currentMoc << "\", " + << "but could not find header \"" << basename + << '{' << this->JoinExts(headerExtensions) << "}\" "; if (mocSubDir.empty()) { - std::cerr << "in " << absPath << "\n" << std::endl; + err << "in " << absPath << "\n" << std::endl; } else { - std::cerr << "neither in " << absPath - << " nor in " << mocSubDir << "\n" << std::endl; + err << "neither in " << absPath + << " nor in " << mocSubDir << "\n" << std::endl; } - + this->LogError(err.str()); ::exit(EXIT_FAILURE); } } @@ -899,12 +923,14 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, { if (basename != scannedFileBasename) { - std::cerr <<"AUTOGEN: error: " << absFilename << ": The file " - "includes the moc file \"" << currentMoc << - "\", which seems to be the moc file from a different " - "source file. This is not supported. " - "Include \"" << scannedFileBasename << ".moc\" to run " - "moc on this source file.\n" << std::endl; + std::stringstream err; + err << "AUTOGEN: error: " << absFilename << ": The file " + "includes the moc file \"" << currentMoc << + "\", which seems to be the moc file from a different " + "source file. This is not supported. " + "Include \"" << scannedFileBasename << ".moc\" to run " + "moc on this source file.\n" << std::endl; + this->LogError(err.str()); ::exit(EXIT_FAILURE); } dotMocIncluded = true; @@ -923,10 +949,12 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, macroName))) { // otherwise always error out since it will not compile: - std::cerr << "AUTOGEN: error: " << absFilename << ": The file " - << "contains a " << macroName << " macro, but does not include " - << "\"" << scannedFileBasename << ".moc\" !\n" - << std::endl; + std::stringstream err; + err << "AUTOGEN: error: " << absFilename << ": The file " + << "contains a " << macroName << " macro, but does not include " + << "\"" << scannedFileBasename << ".moc\" !\n" + << std::endl; + this->LogError(err.str()); ::exit(EXIT_FAILURE); } @@ -943,8 +971,10 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, const std::string contentsString = ReadAll(absFilename); if (contentsString.empty()) { - std::cerr << "AUTOGEN: warning: " << absFilename << ": file is empty\n" - << std::endl; + std::stringstream err; + err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" + << std::endl; + this->LogError(err.str()); return; } this->ParseForUic(absFilename, contentsString, includedUis); @@ -1045,13 +1075,14 @@ void cmQtAutoGenerators::ParseHeaders(const std::set<std::string>& absHeaders, { if (this->Verbose) { - std::cout << "AUTOGEN: Checking " << headerName << std::endl; + std::stringstream err; + err << "AUTOGEN: Checking " << headerName << std::endl; + this->LogInfo(err.str()); } std::string macroName; if (requiresMocing(contents, macroName)) { - //std::cout << "header contains Q_OBJECT macro"; const std::string parentDir = this->TargetBuildSubDir + this->SourceRelativePath ( headerName ); const std::string basename = cmsys::SystemTools:: @@ -1077,14 +1108,15 @@ bool cmQtAutoGenerators::GenerateMocFiles( mergedMocs.insert ( notIncludedMocs.begin(), notIncludedMocs.end() ); if( this->NameCollisionTest ( mergedMocs, collisions ) ) { - std::cerr << + std::stringstream err; + err << "AUTOGEN: error: " "The same moc file will be generated " "from different sources." << std::endl << "To avoid this error either" << std::endl << "- rename the source files or" << std::endl << "- do not include the (moc_NAME.cpp|NAME.moc) file" << std::endl; - this->NameCollisionLog ( collisions ); + this->NameCollisionLog ( err.str(), collisions ); ::exit(EXIT_FAILURE); } } @@ -1153,8 +1185,10 @@ bool cmQtAutoGenerators::GenerateMocFiles( // nothing changed: don't touch the _automoc.cpp file if (this->Verbose) { - std::cout << "AUTOGEN: " << this->OutMocCppFilenameRel - << " still up to date" << std::endl; + std::stringstream err; + err << "AUTOGEN: " << this->OutMocCppFilenameRel + << " still up to date" << std::endl; + this->LogInfo(err.str()); } return true; } @@ -1162,7 +1196,7 @@ bool cmQtAutoGenerators::GenerateMocFiles( // actually write _automoc.cpp { - std::string msg = "Generating "; + std::string msg = "Generating moc compilation "; msg += this->OutMocCppFilenameRel; cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |cmsysTerminal_Color_ForegroundBold, @@ -1197,7 +1231,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, cmsys::SystemTools::MakeDirectory(mocDir.c_str()); } - std::string msg = "Generating "; + std::string msg = "Generating moc source "; msg += mocFileName; cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |cmsysTerminal_Color_ForegroundBold, @@ -1229,8 +1263,10 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, &retVal); if (!result || retVal) { - std::cerr << "AUTOGEN: error: process for " << mocFilePath <<" failed:\n" - << output << std::endl; + std::stringstream err; + err << "AUTOGEN: error: process for " << mocFilePath <<" failed:\n" + << output << std::endl; + this->LogError(err.str()); this->RunMocFailed = true; cmSystemTools::RemoveFile(mocFilePath); } @@ -1272,10 +1308,11 @@ bool cmQtAutoGenerators::GenerateUiFiles( std::multimap<std::string, std::string> collisions; if( this->NameCollisionTest ( testMap, collisions ) ) { - std::cerr << "AUTOGEN: error: The same ui_NAME.h file will be generated " - "from different sources." << std::endl - << "To avoid this error rename the source files." << std::endl; - this->NameCollisionLog ( collisions ); + std::stringstream err; + err << "AUTOGEN: error: The same ui_NAME.h file will be generated " + "from different sources." << std::endl + << "To avoid this error rename the source files." << std::endl; + this->NameCollisionLog ( err.str(), collisions ); ::exit(EXIT_FAILURE); } } @@ -1321,7 +1358,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, &sourceNewerThanUi); if (this->GenerateAll || !success || sourceNewerThanUi >= 0) { - std::string msg = "Generating "; + std::string msg = "Generating ui header "; msg += uiOutputFile; cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |cmsysTerminal_Color_ForegroundBold, @@ -1356,9 +1393,11 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, &retVal); if (!result || retVal) { - std::cerr << "AUTOUIC: error: process for " << uiOutputFile << - " needed by\n \"" << realName << "\"\nfailed:\n" << output - << std::endl; + std::stringstream err; + err << "AUTOUIC: error: process for " << uiOutputFile << + " needed by\n \"" << realName << "\"\nfailed:\n" << output + << std::endl; + this->LogError(err.str()); this->RunUicFailed = true; cmSystemTools::RemoveFile(uiOutputFile); return false; @@ -1413,11 +1452,12 @@ bool cmQtAutoGenerators::GenerateQrcFiles() std::multimap<std::string, std::string> collisions; if( this->NameCollisionTest ( qrcGenMap, collisions ) ) { - std::cerr << "AUTOGEN: error: The same qrc_NAME.cpp file" - " will be generated from different sources." << std::endl - << "To avoid this error rename the source .qrc files." - << std::endl; - this->NameCollisionLog ( collisions ); + std::stringstream err; + err << "AUTOGEN: error: The same qrc_NAME.cpp file" + " will be generated from different sources." << std::endl + << "To avoid this error rename the source .qrc files." + << std::endl; + this->NameCollisionLog ( err.str(), collisions ); ::exit(EXIT_FAILURE); } } @@ -1457,7 +1497,7 @@ bool cmQtAutoGenerators::GenerateQrc ( if (this->GenerateAll || generateQrc) { - std::string msg = "Generating "; + std::string msg = "Generating qrc source "; msg += qrcOutputFile; cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue |cmsysTerminal_Color_ForegroundBold, @@ -1489,8 +1529,10 @@ bool cmQtAutoGenerators::GenerateQrc ( &retVal); if (!result || retVal) { - std::cerr << "AUTORCC: error: process for " << qrcOutputFile << - " failed:\n" << output << std::endl; + std::stringstream err; + err << "AUTORCC: error: process for " << qrcOutputFile << + " failed:\n" << output << std::endl; + this->LogError(err.str()); this->RunRccFailed = true; cmSystemTools::RemoveFile(qrcBuildFile); return false; @@ -1582,17 +1624,30 @@ bool cmQtAutoGenerators::NameCollisionTest( } void cmQtAutoGenerators::NameCollisionLog( - const std::multimap<std::string, std::string>& collisions) + const std::string& message, + const std::multimap<std::string, std::string>& collisions) { typedef std::multimap<std::string, std::string>::const_iterator Iter; - std::stringstream sbuf; + std::stringstream err; + // Add message + err << message; + // Append collision list for(Iter it = collisions.begin(); it != collisions.end(); ++it ) { - sbuf << it->first << " : " << it->second << std::endl; + err << it->first << " : " << it->second << std::endl; } - sbuf.flush(); - std::cerr << sbuf.str(); + this->LogError(err.str()); +} + +void cmQtAutoGenerators::LogInfo(const std::string& message) +{ + std::cout << message; +} + +void cmQtAutoGenerators::LogError(const std::string& message) +{ + std::cerr << message; } void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command) @@ -1608,11 +1663,10 @@ void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command) } sbuf << *cmdIt; } - sbuf.flush(); if ( !sbuf.str().empty() ) { - std::cout << sbuf.str(); - std::cout << std::endl; + sbuf << std::endl; + this->LogInfo ( sbuf.str() ); } } diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 422e1ed..e46e0fc 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -83,8 +83,11 @@ private: bool NameCollisionTest(const std::map<std::string, std::string >& genFiles, std::multimap<std::string, std::string>& collisions ); void NameCollisionLog( - const std::multimap<std::string, std::string>& collisions ); + const std::string& message, + const std::multimap<std::string, std::string>& collisions ); + void LogInfo(const std::string& message); + void LogError(const std::string& message); void LogCommand(const std::vector<std::string>& command); std::string JoinExts(const std::vector<std::string>& lst); |