automoc: add variable CMAKE_AUTOMOC_STRICT_MODE, to enable strict parsing
Alex
This commit is contained in:
parent
40c516783e
commit
62e223e8fa
|
@ -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_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
|
||||||
set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" )
|
set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" )
|
||||||
set(AM_TARGET_NAME "@_moc_target_name@")
|
set(AM_TARGET_NAME "@_moc_target_name@")
|
||||||
|
set(AM_STRICT_MODE "@_moc_strict_mode@")
|
||||||
|
|
|
@ -115,6 +115,12 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
||||||
return;
|
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:
|
// create a custom target for running automoc at buildtime:
|
||||||
std::string automocTargetName = targetName;
|
std::string automocTargetName = targetName;
|
||||||
automocTargetName += "_automoc";
|
automocTargetName += "_automoc";
|
||||||
|
@ -196,6 +202,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
||||||
makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str());
|
makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str());
|
||||||
makefile->AddDefinition("_moc_files", _moc_files.c_str());
|
makefile->AddDefinition("_moc_files", _moc_files.c_str());
|
||||||
makefile->AddDefinition("_moc_headers", _moc_headers.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");
|
const char* cmakeRoot = makefile->GetDefinition("CMAKE_ROOT");
|
||||||
std::string inputFile = cmakeRoot;
|
std::string inputFile = cmakeRoot;
|
||||||
|
@ -289,6 +296,8 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
|
||||||
this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
|
this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR");
|
||||||
this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
|
this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME");
|
||||||
|
|
||||||
|
this->StrictMode = makefile->IsOn("AM_STRICT_MODE");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,11 +490,11 @@ bool cmQtAutomoc::RunAutomocQt4()
|
||||||
{
|
{
|
||||||
std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
|
std::cout << "AUTOMOC: Checking " << absFilename << std::endl;
|
||||||
}
|
}
|
||||||
if (this->QtMajorVersion == "4")
|
if (this->StrictMode == false)
|
||||||
{
|
{
|
||||||
this->ParseCppFile(absFilename, headerExtensions, includedMocs);
|
this->ParseCppFile(absFilename, headerExtensions, includedMocs);
|
||||||
}
|
}
|
||||||
else if (this->QtMajorVersion == "5")
|
else
|
||||||
{
|
{
|
||||||
this->StrictParseCppFile(absFilename, headerExtensions, includedMocs);
|
this->StrictParseCppFile(absFilename, headerExtensions, includedMocs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ private:
|
||||||
bool ColorOutput;
|
bool ColorOutput;
|
||||||
bool RunMocFailed;
|
bool RunMocFailed;
|
||||||
bool GenerateAll;
|
bool GenerateAll;
|
||||||
|
bool StrictMode;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue