Automoc: fix #13493, use target properties for include dirs

Alex
This commit is contained in:
Alex Neundorf 2012-08-27 22:08:54 +02:00
parent b001b6e129
commit 825d1abf14
1 changed files with 16 additions and 4 deletions

View File

@ -111,6 +111,7 @@ cmQtAutomoc::cmQtAutomoc()
void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
{ {
cmMakefile* makefile = target->GetMakefile(); cmMakefile* makefile = target->GetMakefile();
cmLocalGenerator* localGen = makefile->GetLocalGenerator();
const char* targetName = target->GetName(); const char* targetName = target->GetName();
// don't do anything if there is no Qt4 or Qt5Core (which contains moc): // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR"); std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
@ -193,11 +194,22 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
} }
} }
const char* tmp = makefile->GetProperty("INCLUDE_DIRECTORIES"); std::vector<std::string> includeDirs = target->GetIncludeDirectories();
std::string _moc_incs = (tmp!=0 ? tmp : ""); localGen->GetIncludeDirectories(includeDirs, target, "CXX");
tmp = makefile->GetProperty("DEFINITIONS"); std::string _moc_incs = "";
const char* sep = "";
for(std::vector<std::string>::const_iterator incDirIt = includeDirs.begin();
incDirIt != includeDirs.end();
++incDirIt)
{
_moc_incs += sep;
sep = ";";
_moc_incs += *incDirIt;
}
const char* tmp = makefile->GetProperty("DEFINITIONS");
std::string _moc_defs = (tmp!=0 ? tmp : ""); std::string _moc_defs = (tmp!=0 ? tmp : "");
tmp = makefile->GetProperty("COMPILE_DEFINITIONS"); tmp = target->GetProperty("COMPILE_DEFINITIONS");
std::string _moc_compile_defs = (tmp!=0 ? tmp : ""); std::string _moc_compile_defs = (tmp!=0 ? tmp : "");
tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
std::string _moc_options = (tmp!=0 ? tmp : ""); std::string _moc_options = (tmp!=0 ? tmp : "");