summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-12-10 14:53:00 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-12-11 14:30:12 (GMT)
commit035b6908829f524936a6819a342cdff145708529 (patch)
treed1f311fa94d716ca02f585c9296382d3efb18f4d /Source
parent2fcafbf613f07d6b2484a1dfdb6ba7cd2fc4a645 (diff)
downloadCMake-035b6908829f524936a6819a342cdff145708529.zip
CMake-035b6908829f524936a6819a342cdff145708529.tar.gz
CMake-035b6908829f524936a6819a342cdff145708529.tar.bz2
Autogen: Split AutoRcc handling into two methods
The initialize method changes the target, whereas the setup method does not.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenerators.cxx56
-rw-r--r--Source/cmQtAutoGenerators.h1
2 files changed, 37 insertions, 20 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 835e3b4..1988c5d 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -221,6 +221,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
if (target->GetPropertyAsBool("AUTORCC"))
{
toolNames.push_back("rcc");
+ this->InitializeAutoRccTarget(target);
}
std::string tools = toolNames[0];
@@ -801,14 +802,47 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
+void cmQtAutoGenerators::InitializeAutoRccTarget(cmTarget* target)
+{
+ cmMakefile *makefile = target->GetMakefile();
+
+ const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
+
+ 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().c_str());
+ bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"));
+
+ if (!skip)
+ {
+ std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(absFile);
+
+ std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
+ rcc_output_file += "/qrc_" + basename + ".cpp";
+ makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+ rcc_output_file.c_str(), false);
+ cmSourceFile* rccCppSource
+ = makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
+ target->AddSourceFile(rccCppSource);
+ }
+ }
+ }
+}
+
void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
{
std::string _rcc_files;
const char* sepRccFiles = "";
cmMakefile *makefile = target->GetMakefile();
- std::vector<cmSourceFile*> newFiles;
-
const std::vector<cmSourceFile*>& srcFiles = target->GetSourceFiles();
std::string rccFileFiles;
@@ -841,17 +875,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
_rcc_files += absFile;
sepRccFiles = ";";
- std::string basename = cmsys::SystemTools::
- GetFilenameWithoutLastExtension(absFile);
-
- std::string rcc_output_file = makefile->GetCurrentOutputDirectory();
- rcc_output_file += "/qrc_" + basename + ".cpp";
- makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
- rcc_output_file.c_str(), false);
- cmSourceFile* rccCppSource
- = makefile->GetOrCreateSource(rcc_output_file.c_str(), true);
- newFiles.push_back(rccCppSource);
-
if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS"))
{
std::vector<std::string> optsVec;
@@ -880,13 +903,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
}
}
- for(std::vector<cmSourceFile*>::const_iterator fileIt = newFiles.begin();
- fileIt != newFiles.end();
- ++fileIt)
- {
- target->AddSourceFile(*fileIt);
- }
-
makefile->AddDefinition("_rcc_files",
cmLocalGenerator::EscapeForCMake(_rcc_files.c_str()).c_str());
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index e877f7d..0888ea4 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -33,6 +33,7 @@ private:
std::map<std::string, std::string> &configDefines);
void SetupAutoUicTarget(cmTarget* target,
std::map<std::string, std::string> &configUicOptions);
+ void InitializeAutoRccTarget(cmTarget* target);
void SetupAutoRccTarget(cmTarget* target);
cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,