diff options
-rw-r--r-- | Modules/AutomocInfo.cmake.in | 1 | ||||
-rw-r--r-- | Source/cmQtAutomoc.cxx | 13 | ||||
-rw-r--r-- | Source/cmQtAutomoc.h | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/Modules/AutomocInfo.cmake.in b/Modules/AutomocInfo.cmake.in index 2dc3aa2..293ba64 100644 --- a/Modules/AutomocInfo.cmake.in +++ b/Modules/AutomocInfo.cmake.in @@ -11,3 +11,4 @@ set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/") set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/") set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" ) set(AM_TARGET_NAME "@_moc_target_name@") +set(AM_STRICT_MODE "@_moc_strict_mode@") 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; }; |