Building a qmake C++17 project

Hi; I’m attempting to put together a Snapcraft in order to distribute a Qt-based app that uses qmake and C++17. I appear to fall between two stools:

  • core18 doesn’t support C++17; and
  • core20 doesn’t support the qmake plugin.

Can anyone offer any advice on how to overcome at least one of those obstacles?

Presumably the qmake plugin will eventually be ported to core20, but for now it is probably easier to stick with core18 in the interim.

The compiler in Ubuntu 18.04 should have pretty good C++17 support. It sounds like the problem instead is the Qt version based on this Stack Overflow answer:

While you can’t use CONFIG = c++17, it sounds like the older Qt will accept CONFIG += c++1z (the alias the standard was going by when they didn’t know when it would release). If that doesn’t work, QMAKE_CXXFLAGS += -std=c++17 should.

For the record, CONFIG += c++1z proved to be sufficient, and judging by package names alone it appears that GCC 7 is what ends up being used, which is indeed almost fully C++17 conformant — only some parts of template argument deduction for class templates are unimplemented in GCC 7 per gcc.gnu.org.