mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
AutoMoc: Only add the WIN32 define if the target system is Windows
When there's no moc_predefs.h generated, we add the WIN32 define as fallback. Before this change, we added the WIN32 define if the host system was Windows. That's wrong when cross-compiling. Now we're checking whether the target system is Windows. Fixes: #22933
This commit is contained in:
@@ -636,12 +636,12 @@ bool cmQtAutoGenInitializer::InitMoc()
|
||||
auto getDefs = [this](std::string const& cfg) -> std::set<std::string> {
|
||||
std::set<std::string> defines;
|
||||
this->LocalGen->GetTargetDefines(this->GenTarget, cfg, "CXX", defines);
|
||||
#ifdef _WIN32
|
||||
if (this->Moc.PredefsCmd.empty()) {
|
||||
if (this->Moc.PredefsCmd.empty() &&
|
||||
this->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME") ==
|
||||
"Windows") {
|
||||
// Add WIN32 definition if we don't have a moc_predefs.h
|
||||
defines.insert("WIN32");
|
||||
}
|
||||
#endif
|
||||
return defines;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user