summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutomoc.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2011-11-10 14:46:13 (GMT)
committerStephen Kelly <steveire@gmail.com>2011-11-10 14:46:13 (GMT)
commitb8c8cab2428b10d5a1cb3af4ae72bc3c3f091f4d (patch)
tree4c3a7244ad733dc3d737f6d74164a2cef8edbcfe /Source/cmQtAutomoc.cxx
parentbafe5cc6e90ebb510dfe992c8a7a1eca55826813 (diff)
parent5675ec5e493e01e10d9ad8d8b60eac62033f31c2 (diff)
downloadCMake-b8c8cab2428b10d5a1cb3af4ae72bc3c3f091f4d.zip
CMake-b8c8cab2428b10d5a1cb3af4ae72bc3c3f091f4d.tar.gz
CMake-b8c8cab2428b10d5a1cb3af4ae72bc3c3f091f4d.tar.bz2
Merge remote-tracking branch 'origin/master' into automoc_qt5
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r--Source/cmQtAutomoc.cxx26
1 files changed, 21 insertions, 5 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 72249bc..7a80f28 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -71,7 +71,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
targetDir += ".dir/";
cmCustomCommandLine currentLine;
- currentLine.push_back(makefile->GetCMakeInstance()->GetCMakeCommand());
+ currentLine.push_back(makefile->GetSafeDefinition("CMAKE_COMMAND"));
currentLine.push_back("-E");
currentLine.push_back("cmake_automoc");
currentLine.push_back(targetDir);
@@ -128,9 +128,15 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
}
}
- std::string _moc_incs = makefile->GetProperty("INCLUDE_DIRECTORIES");
- std::string _moc_defs = makefile->GetProperty("DEFINITIONS");
- std::string _moc_compile_defs = makefile->GetProperty("COMPILE_DEFINITIONS");
+ const char* tmp = makefile->GetProperty("INCLUDE_DIRECTORIES");
+ std::string _moc_incs = (tmp!=0 ? tmp : "");
+ tmp = makefile->GetProperty("DEFINITIONS");
+ 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);
static_cast<void>(varScope);
@@ -139,10 +145,11 @@ 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());
- const char* cmakeRoot = makefile->GetDefinition("CMAKE_ROOT");
+ const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
std::string inputFile = cmakeRoot;
inputFile += "/Modules/AutomocInfo.cmake.in";
std::string outputFile = targetDir;
@@ -235,6 +242,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");
@@ -311,6 +319,8 @@ void cmQtAutomoc::Init()
}
}
+ cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions);
+
std::vector<std::string> incPaths;
cmSystemTools::ExpandListArgument(this->MocIncludesStr, incPaths);
@@ -720,6 +730,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