[cmake-developers] Wrong cxx-extension flags
Kornel Benko
kornel at lyx.org
Thu Jul 14 15:59:03 EDT 2016
Am Donnerstag, 14. Juli 2016 um 15:27:00, schrieb Brad King <brad.king at kitware.com>
> On 07/14/2016 02:48 PM, Kornel Benko wrote:
> > I am asking about '-std=gnu++11'.
> On 07/14/2016 02:45 PM, Kornel Benko wrote:
> > The new cmake-files from QT5.7 are somehow responsible that this happens.
>
> The file `lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake` in Qt 5.7 contains:
>
> set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)
>
> This tells CMake that dependents of this library need to be compiled as
> at least C++11. This causes `-std=gnu++11` to be added automatically.
Thanks Brad, that was what I was searching for.
> What you can do is not add your own flag and instead do
>
> set(CMAKE_CXX_STANDARD 14)
>
> or set the CXX_STANDARD property of specific targets. That tells CMake
> to build as C++14 so it will add -std=gnu++14. If you don't want the
> extensions then also set
>
> set(CMAKE_CXX_EXTENSIONS OFF)l
I did this, as it seemed least invasive.
But now, instead of '-std=gnu++1' I got '-std=c++11' which is not better.
Of course, since QT5.7 explicitly requires C++11 features, we don't need C++14.
> Relevant docs:
>
> https://cmake.org/cmake/help/v3.6/manual/cmake-compile-features.7.html
> https://cmake.org/cmake/help/v3.6/variable/CMAKE_CXX_STANDARD.html
> https://cmake.org/cmake/help/v3.6/variable/CMAKE_CXX_EXTENSIONS.html
>
> -Brad
Kornel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160714/fb7ea695/attachment-0001.sig>
More information about the cmake-developers
mailing list