Skip to content

Commit

Permalink
Autogen: Don't add a WIN32 moc definition if we have a moc_predefs.h …
Browse files Browse the repository at this point in the history
…file

On Windows systems we used to add a "-DWIN32" definition to the ``moc``
defines.  This is not necessary anymore when we have a
``moc_predefs.h`` file that provides all compiler predefines.

Closes #18623
  • Loading branch information
Sebastian Holtermann committed Nov 28, 2018
1 parent 0814d74 commit 5f0f84c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Source/cmQtAutoGenInitializer.cxx
Expand Up @@ -521,6 +521,12 @@ bool cmQtAutoGenInitializer::InitMoc()
[this, localGen](std::string const& cfg) -> std::set<std::string> {
std::set<std::string> defines;
localGen->GetTargetDefines(this->Target, cfg, "CXX", defines);
#ifdef _WIN32
if (this->Moc.PredefsCmd.empty()) {
// Add WIN32 definition if we don't have a moc_predefs.h
defines.insert("WIN32");
}
#endif
return defines;
};

Expand Down
10 changes: 0 additions & 10 deletions Source/cmQtAutoGeneratorMocUic.cxx
Expand Up @@ -1279,16 +1279,6 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
Moc_.SkipList.insert(lst.begin(), lst.end());
}
Moc_.Definitions = InfoGetConfigList("AM_MOC_DEFINITIONS");
#ifdef _WIN32
{
std::string win32("WIN32");
auto itB = Moc().Definitions.cbegin();
auto itE = Moc().Definitions.cend();
if (std::find(itB, itE, win32) == itE) {
Moc_.Definitions.emplace_back(std::move(win32));
}
}
#endif
Moc_.IncludePaths = InfoGetConfigList("AM_MOC_INCLUDES");
Moc_.Options = InfoGetList("AM_MOC_OPTIONS");
Moc_.RelaxedMode = InfoGetBool("AM_MOC_RELAXED_MODE");
Expand Down

0 comments on commit 5f0f84c

Please sign in to comment.