QtAutogen: Move MergeRccOptions method.

This commit is contained in:
Stephen Kelly 2015-10-05 18:50:47 +02:00
parent 59b91107d1
commit 2aa3f500c4
1 changed files with 44 additions and 44 deletions

View File

@ -391,6 +391,50 @@ std::string cmQtAutoGeneratorInitializer::GetRccExecutable(
return std::string();
}
void cmQtAutoGeneratorInitializer::MergeRccOptions(
std::vector<std::string> &opts,
const std::vector<std::string> &fileOpts,
bool isQt5)
{
static const char* valueOptions[] = {
"name",
"root",
"compress",
"threshold"
};
std::vector<std::string> extraOpts;
for(std::vector<std::string>::const_iterator it = fileOpts.begin();
it != fileOpts.end(); ++it)
{
std::vector<std::string>::iterator existingIt
= std::find(opts.begin(), opts.end(), *it);
if (existingIt != opts.end())
{
const char *o = it->c_str();
if (*o == '-')
{
++o;
}
if (isQt5 && *o == '-')
{
++o;
}
if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions),
cmStrCmp(*it)) != cmArrayEnd(valueOptions))
{
assert(existingIt + 1 != opts.end());
*(existingIt + 1) = *(it + 1);
++it;
}
}
else
{
extraOpts.push_back(*it);
}
}
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
std::string cmQtAutoGeneratorInitializer::GetAutogenTargetName(
cmTarget const* target)
{
@ -912,50 +956,6 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
}
}
void cmQtAutoGeneratorInitializer::MergeRccOptions(
std::vector<std::string> &opts,
const std::vector<std::string> &fileOpts,
bool isQt5)
{
static const char* valueOptions[] = {
"name",
"root",
"compress",
"threshold"
};
std::vector<std::string> extraOpts;
for(std::vector<std::string>::const_iterator it = fileOpts.begin();
it != fileOpts.end(); ++it)
{
std::vector<std::string>::iterator existingIt
= std::find(opts.begin(), opts.end(), *it);
if (existingIt != opts.end())
{
const char *o = it->c_str();
if (*o == '-')
{
++o;
}
if (isQt5 && *o == '-')
{
++o;
}
if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions),
cmStrCmp(*it)) != cmArrayEnd(valueOptions))
{
assert(existingIt + 1 != opts.end());
*(existingIt + 1) = *(it + 1);
++it;
}
}
else
{
extraOpts.push_back(*it);
}
}
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target)
{
std::string _rcc_files;