Skip to content

[core] CXX standard is not enforced correctly

Currently, it looks like the c++ standard is set incorrectly in file CMakeLists.txt. The build command issued does not contain any std=C++xx flag, which makes it possible to use newer C++ features, which is probably not what was intended.

The CMakesLists.txt tries to set C++14 standard two times :

  • set(CXX_STANDARD 14) : This is the wrong variable (in fact it is a target property), the correct one is CMAKE_CXX_STANDARD, see the official documentation or this SO answer.

  • target_compile_features(${module_name} PRIVATE cxx_std_14) : According to the official documentation, "one may specify a meta-feature (e.g. cxx_std_11) that requires use of a compiler mode that is at minimum aware of that standard, but could be greater.".

Could probably be fixed by :

set(CMAKE_CXX_STANDARD 14) # C++14...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++14

Which at least results on the build command having the std=c++14 flag.

Edited by Jerome Hue