summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerators.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-02-22 16:40:36 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-02-22 20:13:48 (GMT)
commit70ebf35cdaaf391138df7564a07cd205de4af971 (patch)
treed9ae65c5c8ef3d0283ef1264c74c59bc0031366b /Source/cmQtAutoGenerators.cxx
parent2a6fd4328adfad4cae0097d6d71e571c122fc0d1 (diff)
downloadCMake-70ebf35cdaaf391138df7564a07cd205de4af971.zip
CMake-70ebf35cdaaf391138df7564a07cd205de4af971.tar.gz
CMake-70ebf35cdaaf391138df7564a07cd205de4af971.tar.bz2
Autogen: Add AUTOMOC_DEPEND_FILTERS support
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r--Source/cmQtAutoGenerators.cxx60
1 files changed, 50 insertions, 10 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 4463d62..e1b4f35 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -260,6 +260,32 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
return success;
}
+bool cmQtAutoGenerators::MocDependFilterPush(const std::string& key,
+ const std::string& regExp)
+{
+ bool success = false;
+ if (!key.empty()) {
+ if (!regExp.empty()) {
+ MocDependFilter filter;
+ filter.key = key;
+ if (filter.regExp.compile(regExp)) {
+ this->MocDependFilters.push_back(filter);
+ success = true;
+ } else {
+ this->LogError("AutoMoc: Error in AUTOMOC_DEPEND_FILTERS: Compiling "
+ "regular expression failed.\nKey: \"" +
+ key + "\"\nReg. exp.: \"" + regExp + "\"");
+ }
+ } else {
+ this->LogError("AutoMoc: Error in AUTOMOC_DEPEND_FILTERS: Regular "
+ "expression is empty");
+ }
+ } else {
+ this->LogError("AutoMoc: Error in AUTOMOC_DEPEND_FILTERS: Key is empty");
+ }
+ return success;
+}
+
bool cmQtAutoGenerators::ReadAutogenInfoFile(
cmMakefile* makefile, const std::string& targetDirectory,
const std::string& config)
@@ -320,6 +346,30 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
this->MocIncludePaths);
cmSystemTools::ExpandListArgument(
makefile->GetSafeDefinition("AM_MOC_OPTIONS"), this->MocOptions);
+ {
+ std::vector<std::string> mocDependFilters;
+ cmSystemTools::ExpandListArgument(
+ makefile->GetSafeDefinition("AM_MOC_DEPEND_FILTERS"), mocDependFilters);
+ // Insert Q_PLUGIN_METADATA dependency filter
+ if (this->QtMajorVersion != "4") {
+ this->MocDependFilterPush("Q_PLUGIN_METADATA",
+ "[\n][ \t]*Q_PLUGIN_METADATA[ \t]*\\("
+ "[^\\)]*FILE[ \t]*\"([^\"]+)\"");
+ }
+ // Insert user defined dependency filters
+ if ((mocDependFilters.size() % 2) == 0) {
+ for (std::vector<std::string>::const_iterator dit =
+ mocDependFilters.begin();
+ dit != mocDependFilters.end(); dit += 2) {
+ if (!this->MocDependFilterPush(*dit, *(dit + 1))) {
+ return false;
+ }
+ }
+ } else {
+ this->LogError("AutoMoc: Error: AUTOMOC_DEPEND_FILTERS list size is not "
+ "a multiple of 2");
+ }
+ }
// - Uic
cmSystemTools::ExpandListArgument(makefile->GetSafeDefinition("AM_UIC_SKIP"),
@@ -559,16 +609,6 @@ void cmQtAutoGenerators::Init(cmMakefile* makefile)
this->MocIncludes.push_back(*it);
}
}
-
- // Insert MocDependFilter for Q_PLUGIN_METADATA
- if (QtMajorVersion != "4") {
- MocDependFilter filter;
- filter.key = "Q_PLUGIN_METADATA";
- filter.regExp.compile("[\n][ \t]*"
- "Q_PLUGIN_METADATA[ \t]*\\("
- "[^\\)]*FILE[ \t]*\"([^\"]+)\"");
- this->MocDependFilters.push_back(filter);
- }
}
bool cmQtAutoGenerators::RunAutogen()