summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-12-02 21:08:06 (GMT)
committerAlex Neundorf <neundorf@kde.org>2011-12-02 21:08:06 (GMT)
commit62e223e8fab50e87a804efd822dc336577608a9d (patch)
treef6d87564bd9c3716156b643aab2ecbeb9acb45eb /Source
parent40c516783e1df141f3d4a8f6400e90da822395c1 (diff)
downloadCMake-62e223e8fab50e87a804efd822dc336577608a9d.zip
CMake-62e223e8fab50e87a804efd822dc336577608a9d.tar.gz
CMake-62e223e8fab50e87a804efd822dc336577608a9d.tar.bz2
automoc: add variable CMAKE_AUTOMOC_STRICT_MODE, to enable strict parsing
Alex
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutomoc.cxx13
-rw-r--r--Source/cmQtAutomoc.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index aa8c6e2..77b724c 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -115,6 +115,12 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
return;
}
+ bool strictMode = (qtMajorVersion == "5");
+ if (makefile->IsDefinitionSet("CMAKE_AUTOMOC_STRICT_MODE"))
+ {
+ strictMode = makefile->IsOn("CMAKE_AUTOMOC_STRICT_MODE");
+ }
+
// create a custom target for running automoc at buildtime:
std::string automocTargetName = targetName;
automocTargetName += "_automoc";
@@ -196,6 +202,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str());
makefile->AddDefinition("_moc_files", _moc_files.c_str());
makefile->AddDefinition("_moc_headers", _moc_headers.c_str());
+ makefile->AddDefinition("_moc_strict_mode", strictMode ? "TRUE" : "FALSE");
const char* cmakeRoot = makefile->GetDefinition("CMAKE_ROOT");
std::string inputFile = cmakeRoot;
@@ -289,6 +296,8 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
+ this->StrictMode = makefile->IsOn("AM_STRICT_MODE");
+
return true;
}
@@ -481,11 +490,11 @@ bool cmQtAutomoc::RunAutomocQt4()
{
std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
}
- if (this->QtMajorVersion == "4")
+ if (this->StrictMode == false)
{
this->ParseCppFile(absFilename, headerExtensions, includedMocs);
}
- else if (this->QtMajorVersion == "5")
+ else
{
this->StrictParseCppFile(absFilename, headerExtensions, includedMocs);
}
diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h
index d91df61..7aa1bea 100644
--- a/Source/cmQtAutomoc.h
+++ b/Source/cmQtAutomoc.h
@@ -83,6 +83,7 @@ private:
bool ColorOutput;
bool RunMocFailed;
bool GenerateAll;
+ bool StrictMode;
};