summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx2
-rw-r--r--Source/cmQtAutoGenerators.cxx60
-rw-r--r--Source/cmQtAutoGenerators.h1
-rw-r--r--Source/cmTarget.cxx1
4 files changed, 54 insertions, 10 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 52112ff..de18265 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -218,6 +218,8 @@ static void MocSetupAutoTarget(
AddDefinitionEscaped(makefile, "_moc_relaxed_mode",
makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE") ? "TRUE"
: "FALSE");
+ AddDefinitionEscaped(makefile, "_moc_depend_filters",
+ GetSafeProperty(target, "AUTOMOC_DEPEND_FILTERS"));
// Moc includes and compile definitions
{
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()
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index c20b83c..e4b7f60 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -33,6 +33,7 @@ private:
typedef std::pair<std::string, cmsys::RegularExpression> MacroFilter;
// - Configuration
+ bool MocDependFilterPush(const std::string& key, const std::string& regExp);
bool ReadAutogenInfoFile(cmMakefile* makefile,
const std::string& targetDirectory,
const std::string& config);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ad3d604..0f3d91b 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -245,6 +245,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->SetPropertyDefault("AUTOMOC", CM_NULLPTR);
this->SetPropertyDefault("AUTOUIC", CM_NULLPTR);
this->SetPropertyDefault("AUTORCC", CM_NULLPTR);
+ this->SetPropertyDefault("AUTOMOC_DEPEND_FILTERS", CM_NULLPTR);
this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", CM_NULLPTR);
this->SetPropertyDefault("AUTOUIC_OPTIONS", CM_NULLPTR);
this->SetPropertyDefault("AUTORCC_OPTIONS", CM_NULLPTR);