diff options
author | Alex Neundorf <neundorf@kde.org> | 2011-11-01 13:33:11 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2011-11-01 13:33:11 (GMT) |
commit | 52719a1d66db0bbdb17019bcb2ea5ab0a1258e22 (patch) | |
tree | 00916b0af679723b3fe59286139ed493ce8b286f /Source | |
parent | 1ecc55aa7b95a487996654e81d6493e7b72961c0 (diff) | |
download | CMake-52719a1d66db0bbdb17019bcb2ea5ab0a1258e22.zip CMake-52719a1d66db0bbdb17019bcb2ea5ab0a1258e22.tar.gz CMake-52719a1d66db0bbdb17019bcb2ea5ab0a1258e22.tar.bz2 |
automoc: fix #12541, support moc options
This commit adds a new target property AUTOMOC_MOC_OPTIONS, which
can be set to add extra options for the moc invocations done via automoc.
This is equivalent to the OPTIONS parameter in the qt4_wrap_cpp() macro.
Alex
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutomoc.cxx | 12 | ||||
-rw-r--r-- | Source/cmQtAutomoc.h | 2 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index e9cc9d1..eb89c90 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -130,6 +130,8 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) std::string _moc_defs = (tmp!=0 ? tmp : ""); tmp = makefile->GetProperty("COMPILE_DEFINITIONS"); std::string _moc_compile_defs = (tmp!=0 ? tmp : ""); + tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); + std::string _moc_options = (tmp!=0 ? tmp : ""); // forget the variables added here afterwards again: cmMakefile::ScopePushPop varScope(makefile); @@ -139,6 +141,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) makefile->AddDefinition("_moc_incs", _moc_incs.c_str()); makefile->AddDefinition("_moc_defs", _moc_defs.c_str()); makefile->AddDefinition("_moc_compile_defs", _moc_compile_defs.c_str()); + makefile->AddDefinition("_moc_options", _moc_options.c_str()); makefile->AddDefinition("_moc_files", _moc_files.c_str()); makefile->AddDefinition("_moc_headers", _moc_headers.c_str()); @@ -230,6 +233,7 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile, "AM_MOC_COMPILE_DEFINITIONS"); this->MocDefinitionsStr = makefile->GetSafeDefinition("AM_MOC_DEFINITIONS"); this->MocIncludesStr = makefile->GetSafeDefinition("AM_MOC_INCLUDES"); + this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS"); this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); this->ProjectSourceDir = makefile->GetSafeDefinition("AM_CMAKE_SOURCE_DIR"); this->TargetName = makefile->GetSafeDefinition("AM_TARGET_NAME"); @@ -306,6 +310,8 @@ void cmQtAutomoc::Init() } } + cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions); + std::vector<std::string> incPaths; cmSystemTools::ExpandListArgument(this->MocIncludesStr, incPaths); @@ -715,6 +721,12 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile, { command.push_back(*it); } + for(std::vector<std::string>::const_iterator it=this->MocOptions.begin(); + it != this->MocOptions.end(); + ++it) + { + command.push_back(*it); + } #ifdef _WIN32 command.push_back("-DWIN32"); #endif diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h index c3550a4..db53b21 100644 --- a/Source/cmQtAutomoc.h +++ b/Source/cmQtAutomoc.h @@ -62,6 +62,7 @@ private: std::string MocCompileDefinitionsStr; std::string MocDefinitionsStr; std::string MocIncludesStr; + std::string MocOptionsStr; std::string ProjectBinaryDir; std::string ProjectSourceDir; std::string TargetName; @@ -71,6 +72,7 @@ private: std::string OutMocCppFilename; std::list<std::string> MocIncludes; std::list<std::string> MocDefinitions; + std::vector<std::string> MocOptions; bool Verbose; bool ColorOutput; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f7d3ba9..e8064d0 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1179,6 +1179,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("Fortran_MODULE_DIRECTORY", 0); this->SetPropertyDefault("OSX_ARCHITECTURES", 0); this->SetPropertyDefault("AUTOMOC", 0); + this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0); this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0); // Collect the set of configuration types. |