summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerators.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r--Source/cmQtAutoGenerators.cxx78
1 files changed, 48 insertions, 30 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 835e3b4..2b4bb8a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -138,14 +138,14 @@ cmQtAutoGenerators::cmQtAutoGenerators()
}
}
-static std::string getAutogenTargetName(cmTarget *target)
+static std::string getAutogenTargetName(cmTarget const* target)
{
std::string autogenTargetName = target->GetName();
autogenTargetName += "_automoc";
return autogenTargetName;
}
-static std::string getAutogenTargetDir(cmTarget *target)
+static std::string getAutogenTargetDir(cmTarget const* target)
{
cmMakefile* makefile = target->GetMakefile();
std::string targetDir = makefile->GetCurrentOutputDirectory();
@@ -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];
@@ -295,7 +296,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
return true;
}
-static void GetCompileDefinitionsAndDirectories(cmTarget *target,
+static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
const char * config,
std::string &incs,
std::string &defs)
@@ -303,10 +304,12 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target,
cmMakefile* makefile = target->GetMakefile();
cmLocalGenerator* localGen = makefile->GetLocalGenerator();
std::vector<std::string> includeDirs;
- cmGeneratorTarget gtgt(target);
+ cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(target);
// Get the include dirs for this target, without stripping the implicit
// include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
- localGen->GetIncludeDirectories(includeDirs, &gtgt, "CXX", config, false);
+ localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false);
const char* sep = "";
incs = "";
for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin();
@@ -332,7 +335,7 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target,
}
}
-void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
+void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
{
cmMakefile* makefile = target->GetMakefile();
@@ -435,7 +438,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
}
}
-void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget* target,
+void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
const std::string &autogenTargetName,
std::map<std::string, std::string> &configIncludes,
std::map<std::string, std::string> &configDefines)
@@ -614,7 +617,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
-static void GetUicOpts(cmTarget *target, const char * config,
+static void GetUicOpts(cmTarget const* target, const char * config,
std::string &optString)
{
std::vector<std::string> opts;
@@ -631,7 +634,7 @@ static void GetUicOpts(cmTarget *target, const char * config,
}
}
-void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget* target,
+void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
std::map<std::string, std::string> &configUicOptions)
{
cmMakefile *makefile = target->GetMakefile();
@@ -801,14 +804,47 @@ void cmQtAutoGenerators::MergeRccOptions(std::vector<std::string> &opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
-void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget* target)
+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 const* 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 +877,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 +905,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());