jeudi 30 juin 2016

How to control compiler flag invoked when specifing CMAKE_CXX_STANDARD?

I would like to have cmake manage the inclusion of the "-std=c++14" compiler flag. This is easy to do using the CMAKE_CXX_STANDARD as described here. This boils down to including the following:

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)

However, when using gcc, this results in the inclusion of "-std=gnu++14" which includes some non-standard features. Is there a way to have cmake invoke the "-std=c++14" compiler flag when using CMAKE_CXX_STANDARD instead of "-std=gnu++14"?

Aucun commentaire:

Enregistrer un commentaire