Am 05.12.18 um 13:40 schrieb Kim Walisch:
Hi,

I have realized that my C++ primesieve project (https://github.com/kimwalisch/primesieve) is compiled using -std=gnu++11 with GCC 7.3 and CMake 3.10 (on Ubuntu 18.10 x64) even
though the default C++ version used by GCC 7.3 is C++14 as checked below:

$ g++ -dM -E -x c++  /dev/null | grep -F __cplusplus
#define __cplusplus 201402L

Note that I have not set CXX_STANDARD manually in my CMakeLists.txt so I was expecting that my project would be compiled either with -std=gnu++14 or without any C++ version flag. I spent some time investigating where the -std=gnu++11 flag comes from and I found that it is
related to the use of target_compile_features():

target_compile_features(primesieve PRIVATE cxx_auto_type)

This code tells the compiler that my program uses features from C++11 and that the compiler should enable C++11 if the default C++ version of the compiler is e.g. C++98. I would however expect that if the default C++ version of the compiler is > C++11 CMake would not
add -std=gnu++11 to the compiler flags.

For me this is a CMake bug.

Thanks,
Kim Walisch


Hi Kim,

this does indeed sound like some unwanted behavior.

I recommend you open an issue in CMake's issue-tracker (https://gitlab.kitware.com/cmake/cmake/issues) and copy your email-content there.

Best regards,
Deniz Bahadir

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to