Merge topic 'AutomocUseTargetProperties'
e83cc94
Use the cmGeneratorTarget for the include directories API.9d8e59d
Merge branch 'use-generator-target' into AutomocUseTargetPropertiesea12871
Automoc: also the makefile-COMPILE_DEFINITIONS894e91a
Automoc: do not use DEFINITIONS, but only COMPILE_DEFINITIONS825d1ab
Automoc: fix #13493, use target properties for include dirs
This commit is contained in:
commit
2e489526fa
|
@ -1,7 +1,6 @@
|
||||||
set(AM_SOURCES @_moc_files@ )
|
set(AM_SOURCES @_moc_files@ )
|
||||||
set(AM_HEADERS @_moc_headers@ )
|
set(AM_HEADERS @_moc_headers@ )
|
||||||
set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@)
|
set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@)
|
||||||
set(AM_MOC_DEFINITIONS @_moc_defs@)
|
|
||||||
set(AM_MOC_INCLUDES @_moc_incs@)
|
set(AM_MOC_INCLUDES @_moc_incs@)
|
||||||
set(AM_MOC_OPTIONS @_moc_options@)
|
set(AM_MOC_OPTIONS @_moc_options@)
|
||||||
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
|
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
|
||||||
|
|
|
@ -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,12 +194,28 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* tmp = makefile->GetProperty("INCLUDE_DIRECTORIES");
|
std::vector<std::string> includeDirs;
|
||||||
std::string _moc_incs = (tmp!=0 ? tmp : "");
|
cmGeneratorTarget gtgt(target);
|
||||||
tmp = makefile->GetProperty("DEFINITIONS");
|
localGen->GetIncludeDirectories(includeDirs, >gt, "CXX");
|
||||||
std::string _moc_defs = (tmp!=0 ? tmp : "");
|
std::string _moc_incs = "";
|
||||||
tmp = makefile->GetProperty("COMPILE_DEFINITIONS");
|
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 = target->GetProperty("COMPILE_DEFINITIONS");
|
||||||
std::string _moc_compile_defs = (tmp!=0 ? tmp : "");
|
std::string _moc_compile_defs = (tmp!=0 ? tmp : "");
|
||||||
|
tmp = makefile->GetProperty("COMPILE_DEFINITIONS");
|
||||||
|
if (tmp)
|
||||||
|
{
|
||||||
|
_moc_compile_defs += ";";
|
||||||
|
_moc_compile_defs += 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 : "");
|
||||||
|
|
||||||
|
@ -210,8 +227,6 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
||||||
cmLocalGenerator::EscapeForCMake(automocTargetName.c_str()).c_str());
|
cmLocalGenerator::EscapeForCMake(automocTargetName.c_str()).c_str());
|
||||||
makefile->AddDefinition("_moc_incs",
|
makefile->AddDefinition("_moc_incs",
|
||||||
cmLocalGenerator::EscapeForCMake(_moc_incs.c_str()).c_str());
|
cmLocalGenerator::EscapeForCMake(_moc_incs.c_str()).c_str());
|
||||||
makefile->AddDefinition("_moc_defs",
|
|
||||||
cmLocalGenerator::EscapeForCMake(_moc_defs.c_str()).c_str());
|
|
||||||
makefile->AddDefinition("_moc_compile_defs",
|
makefile->AddDefinition("_moc_compile_defs",
|
||||||
cmLocalGenerator::EscapeForCMake(_moc_compile_defs.c_str()).c_str());
|
cmLocalGenerator::EscapeForCMake(_moc_compile_defs.c_str()).c_str());
|
||||||
makefile->AddDefinition("_moc_options",
|
makefile->AddDefinition("_moc_options",
|
||||||
|
@ -314,7 +329,6 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
|
||||||
this->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE");
|
this->MocExecutable = makefile->GetSafeDefinition("AM_QT_MOC_EXECUTABLE");
|
||||||
this->MocCompileDefinitionsStr = makefile->GetSafeDefinition(
|
this->MocCompileDefinitionsStr = makefile->GetSafeDefinition(
|
||||||
"AM_MOC_COMPILE_DEFINITIONS");
|
"AM_MOC_COMPILE_DEFINITIONS");
|
||||||
this->MocDefinitionsStr = makefile->GetSafeDefinition("AM_MOC_DEFINITIONS");
|
|
||||||
this->MocIncludesStr = makefile->GetSafeDefinition("AM_MOC_INCLUDES");
|
this->MocIncludesStr = makefile->GetSafeDefinition("AM_MOC_INCLUDES");
|
||||||
this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS");
|
this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS");
|
||||||
this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
|
this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR");
|
||||||
|
@ -332,7 +346,7 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
|
||||||
std::string cmQtAutomoc::MakeCompileSettingsString(cmMakefile* makefile)
|
std::string cmQtAutomoc::MakeCompileSettingsString(cmMakefile* makefile)
|
||||||
{
|
{
|
||||||
std::string s;
|
std::string s;
|
||||||
s += makefile->GetSafeDefinition("AM_MOC_DEFINITIONS");
|
s += makefile->GetSafeDefinition("AM_MOC_COMPILE_DEFINITIONS");
|
||||||
s += " ~~~ ";
|
s += " ~~~ ";
|
||||||
s += makefile->GetSafeDefinition("AM_MOC_INCLUDES");
|
s += makefile->GetSafeDefinition("AM_MOC_INCLUDES");
|
||||||
s += " ~~~ ";
|
s += " ~~~ ";
|
||||||
|
@ -387,33 +401,12 @@ void cmQtAutomoc::Init()
|
||||||
|
|
||||||
std::vector<std::string> cdefList;
|
std::vector<std::string> cdefList;
|
||||||
cmSystemTools::ExpandListArgument(this->MocCompileDefinitionsStr, cdefList);
|
cmSystemTools::ExpandListArgument(this->MocCompileDefinitionsStr, cdefList);
|
||||||
if (!cdefList.empty())
|
|
||||||
{
|
|
||||||
for(std::vector<std::string>::const_iterator it = cdefList.begin();
|
for(std::vector<std::string>::const_iterator it = cdefList.begin();
|
||||||
it != cdefList.end();
|
it != cdefList.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
this->MocDefinitions.push_back("-D" + (*it));
|
this->MocDefinitions.push_back("-D" + (*it));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string tmpMocDefs = this->MocDefinitionsStr;
|
|
||||||
cmSystemTools::ReplaceString(tmpMocDefs, " ", ";");
|
|
||||||
|
|
||||||
std::vector<std::string> defList;
|
|
||||||
cmSystemTools::ExpandListArgument(tmpMocDefs, defList);
|
|
||||||
|
|
||||||
for(std::vector<std::string>::const_iterator it = defList.begin();
|
|
||||||
it != defList.end();
|
|
||||||
++it)
|
|
||||||
{
|
|
||||||
if (this->StartsWith(*it, "-D"))
|
|
||||||
{
|
|
||||||
this->MocDefinitions.push_back(*it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions);
|
cmSystemTools::ExpandListArgument(this->MocOptionsStr, this->MocOptions);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,6 @@ private:
|
||||||
std::string Builddir;
|
std::string Builddir;
|
||||||
std::string MocExecutable;
|
std::string MocExecutable;
|
||||||
std::string MocCompileDefinitionsStr;
|
std::string MocCompileDefinitionsStr;
|
||||||
std::string MocDefinitionsStr;
|
|
||||||
std::string MocIncludesStr;
|
std::string MocIncludesStr;
|
||||||
std::string MocOptionsStr;
|
std::string MocOptionsStr;
|
||||||
std::string ProjectBinaryDir;
|
std::string ProjectBinaryDir;
|
||||||
|
|
Loading…
Reference in New Issue