summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGeneratorInitializer.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-05 16:55:09 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-05 16:55:09 (GMT)
commit86f7fc5d55da5cf569c516f2d1fb8b69603c1be2 (patch)
treead9088ad5cdb3395db677ee89e6db7b573338921 /Source/cmQtAutoGeneratorInitializer.cxx
parent2aa3f500c49e6c81f4d4b821d6ae71ef2589cb07 (diff)
downloadCMake-86f7fc5d55da5cf569c516f2d1fb8b69603c1be2.zip
CMake-86f7fc5d55da5cf569c516f2d1fb8b69603c1be2.tar.gz
CMake-86f7fc5d55da5cf569c516f2d1fb8b69603c1be2.tar.bz2
QtAutogen: Move SetupAutoRccTarget method.
Diffstat (limited to 'Source/cmQtAutoGeneratorInitializer.cxx')
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx233
1 files changed, 116 insertions, 117 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 9bece40..a2a72d4 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -593,6 +593,122 @@ std::string cmQtAutoGeneratorInitializer::ListQt4RccInputs(cmSourceFile* sf,
return entriesList;
}
+void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target)
+{
+ std::string _rcc_files;
+ const char* sepRccFiles = "";
+ cmMakefile *makefile = target->GetMakefile();
+
+ std::vector<cmSourceFile*> srcFiles;
+ cmGeneratorTarget *gtgt = target->GetMakefile()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
+ gtgt->GetConfigCommonSourceFiles(srcFiles);
+
+ std::string qrcInputs;
+ const char* qrcInputsSep = "";
+
+ std::string rccFileFiles;
+ std::string rccFileOptions;
+ const char *optionSep = "";
+
+ const char *qtVersion = makefile->GetDefinition("_target_qt_version");
+
+ std::vector<std::string> rccOptions;
+ if (const char* opts = target->GetProperty("AUTORCC_OPTIONS"))
+ {
+ cmSystemTools::ExpandListArgument(opts, rccOptions);
+ }
+ std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
+ if (qtMajorVersion == "")
+ {
+ qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
+ }
+
+ for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
+ fileIt != srcFiles.end();
+ ++fileIt)
+ {
+ cmSourceFile* sf = *fileIt;
+ std::string ext = sf->GetExtension();
+ if (ext == "qrc")
+ {
+ std::string absFile = cmsys::SystemTools::GetRealPath(
+ sf->GetFullPath());
+ bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"));
+
+ if (!skip)
+ {
+ _rcc_files += sepRccFiles;
+ _rcc_files += absFile;
+ sepRccFiles = ";";
+
+ if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS"))
+ {
+ std::vector<std::string> optsVec;
+ cmSystemTools::ExpandListArgument(prop, optsVec);
+ cmQtAutoGeneratorInitializer::MergeRccOptions(rccOptions, optsVec,
+ strcmp(qtVersion, "5") == 0);
+ }
+
+ if (!rccOptions.empty())
+ {
+ rccFileFiles += optionSep;
+ rccFileFiles += absFile;
+ rccFileOptions += optionSep;
+ }
+ const char *listSep = "";
+ for(std::vector<std::string>::const_iterator it = rccOptions.begin();
+ it != rccOptions.end();
+ ++it)
+ {
+ rccFileOptions += listSep;
+ rccFileOptions += *it;
+ listSep = "@list_sep@";
+ }
+ optionSep = ";";
+
+ std::vector<std::string> depends;
+
+ std::string entriesList;
+ if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED")))
+ {
+ if (qtMajorVersion == "5")
+ {
+ entriesList = cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf,
+ target,
+ depends);
+ }
+ else
+ {
+ entriesList =
+ cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends);
+ }
+ if (entriesList.empty())
+ {
+ return;
+ }
+ }
+ qrcInputs += qrcInputsSep;
+ qrcInputs += entriesList;
+ qrcInputsSep = ";";
+ }
+ }
+ }
+ makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(),
+ cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
+
+ makefile->AddDefinition("_rcc_files",
+ cmOutputConverter::EscapeForCMake(_rcc_files).c_str());
+
+ makefile->AddDefinition("_qt_rcc_options_files",
+ cmOutputConverter::EscapeForCMake(rccFileFiles).c_str());
+ makefile->AddDefinition("_qt_rcc_options_options",
+ cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
+
+ makefile->AddDefinition("_qt_rcc_executable",
+ cmQtAutoGeneratorInitializer::GetRccExecutable(target).c_str());
+}
void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target)
{
@@ -955,120 +1071,3 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
}
}
}
-
-void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target)
-{
- std::string _rcc_files;
- const char* sepRccFiles = "";
- cmMakefile *makefile = target->GetMakefile();
-
- std::vector<cmSourceFile*> srcFiles;
- cmGeneratorTarget *gtgt = target->GetMakefile()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(target);
- gtgt->GetConfigCommonSourceFiles(srcFiles);
-
- std::string qrcInputs;
- const char* qrcInputsSep = "";
-
- std::string rccFileFiles;
- std::string rccFileOptions;
- const char *optionSep = "";
-
- const char *qtVersion = makefile->GetDefinition("_target_qt_version");
-
- std::vector<std::string> rccOptions;
- if (const char* opts = target->GetProperty("AUTORCC_OPTIONS"))
- {
- cmSystemTools::ExpandListArgument(opts, rccOptions);
- }
- std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
- if (qtMajorVersion == "")
- {
- qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
- }
-
- for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
- fileIt != srcFiles.end();
- ++fileIt)
- {
- cmSourceFile* sf = *fileIt;
- std::string ext = sf->GetExtension();
- if (ext == "qrc")
- {
- std::string absFile = cmsys::SystemTools::GetRealPath(
- sf->GetFullPath());
- bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"));
-
- if (!skip)
- {
- _rcc_files += sepRccFiles;
- _rcc_files += absFile;
- sepRccFiles = ";";
-
- if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS"))
- {
- std::vector<std::string> optsVec;
- cmSystemTools::ExpandListArgument(prop, optsVec);
- cmQtAutoGeneratorInitializer::MergeRccOptions(rccOptions, optsVec,
- strcmp(qtVersion, "5") == 0);
- }
-
- if (!rccOptions.empty())
- {
- rccFileFiles += optionSep;
- rccFileFiles += absFile;
- rccFileOptions += optionSep;
- }
- const char *listSep = "";
- for(std::vector<std::string>::const_iterator it = rccOptions.begin();
- it != rccOptions.end();
- ++it)
- {
- rccFileOptions += listSep;
- rccFileOptions += *it;
- listSep = "@list_sep@";
- }
- optionSep = ";";
-
- std::vector<std::string> depends;
-
- std::string entriesList;
- if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED")))
- {
- if (qtMajorVersion == "5")
- {
- entriesList = cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf,
- target,
- depends);
- }
- else
- {
- entriesList =
- cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends);
- }
- if (entriesList.empty())
- {
- return;
- }
- }
- qrcInputs += qrcInputsSep;
- qrcInputs += entriesList;
- qrcInputsSep = ";";
- }
- }
- }
- makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(),
- cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
-
- makefile->AddDefinition("_rcc_files",
- cmOutputConverter::EscapeForCMake(_rcc_files).c_str());
-
- makefile->AddDefinition("_qt_rcc_options_files",
- cmOutputConverter::EscapeForCMake(rccFileFiles).c_str());
- makefile->AddDefinition("_qt_rcc_options_options",
- cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
-
- makefile->AddDefinition("_qt_rcc_executable",
- cmQtAutoGeneratorInitializer::GetRccExecutable(target).c_str());
-}