Autogen: Check added for name collisions of generated ui_NAME.h files

This commit is contained in:
Sebastian Holtermann 2016-04-18 20:32:44 +02:00 committed by Brad King
parent 8295d43713
commit 663d093d45
1 changed files with 16 additions and 0 deletions

View File

@ -1243,6 +1243,7 @@ bool cmQtAutoGenerators::GenerateUiFiles(
{ {
// single map with input / output names // single map with input / output names
std::map<std::string, std::map<std::string, std::string> > uiGenMap; std::map<std::string, std::map<std::string, std::string> > uiGenMap;
std::map<std::string, std::string> testMap;
for(std::map<std::string, std::vector<std::string> >::const_iterator for(std::map<std::string, std::vector<std::string> >::const_iterator
it = includedUis.begin(); it != includedUis.end(); ++it) it = includedUis.begin(); it != includedUis.end(); ++it)
{ {
@ -1260,9 +1261,24 @@ bool cmQtAutoGenerators::GenerateUiFiles(
const std::string uiInputFile = sourcePath + uiFileName + ".ui"; const std::string uiInputFile = sourcePath + uiFileName + ".ui";
const std::string uiOutputFile = "ui_" + uiFileName + ".h"; const std::string uiOutputFile = "ui_" + uiFileName + ".h";
sourceMap[uiInputFile] = uiOutputFile; sourceMap[uiInputFile] = uiOutputFile;
testMap[uiInputFile] = uiOutputFile;
} }
} }
// look for name collisions
{
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 );
::exit(EXIT_FAILURE);
}
}
testMap.clear();
// generate ui files // generate ui files
for(std::map<std::string, std::map<std::string, std::string> >:: for(std::map<std::string, std::map<std::string, std::string> >::
const_iterator it = uiGenMap.begin(); it != uiGenMap.end(); ++it) const_iterator it = uiGenMap.begin(); it != uiGenMap.end(); ++it)