Use compile-features to determine module support
Currently, cmake checks CMAKE_CXX_STANDARD to determine the module support. Though, gcc and clang can use modules without using c++20 (by using -fmodules
, -fmodule-headers
).
At MariaDB, we would like to take an advantage of the optional module usage to speed up our local build speed, but we can't switch to c++20, because we support platforms that have quite old default compilers. To determine module suport I propose to rely on cmake-compile-features instead, for example as follows:
- Add new compile-feature
cxx_modules
- map it to some recent gcc/clang versions
- add corresponding support flags when c++20 is disabled