CMake >= 3.27 exports the CXX std to moc. This is a workaround for a moc parsing bug that happens parsing headers from libc++ < 14 when the CXX std > 17. usr/include/c++/v1/concept:318:1: error: Parse error at "::" Moc should theoretically be able to parse this. [1] Not exactly sure why it's failing. Upstream bug report [2] [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/tools/moc/moc.cpp?h=6.6.0#n631 [2] https://bugreports.qt.io/browse/QTBUG-117765 Index: Source/cmQtAutoGenInitializer.cxx --- Source/cmQtAutoGenInitializer.cxx.orig +++ Source/cmQtAutoGenInitializer.cxx @@ -1809,6 +1809,10 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() if (this->Moc.PredefsCmd.size() >= 3) { this->Moc.PredefsCmd.insert(this->Moc.PredefsCmd.begin() + 1, CompileOptionValue); +#if (defined(__FreeBSD__) && __FreeBSD_version < 1302000) || defined(__OpenBSD__) + this->Moc.PredefsCmd.insert(this->Moc.PredefsCmd.begin() + 1, + "-D_LIBCPP_HAS_NO_CONCEPTS"); +#endif } } info.SetArray("MOC_PREDEFS_CMD", this->Moc.PredefsCmd);