<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>I have realized that my C++ primesieve project (<a href="https://github.com/kimwalisch/primesieve">https://github.com/kimwalisch/primesieve</a>) is</div><div>compiled using -std=gnu++11 with GCC 7.3 and CMake 3.10 (on Ubuntu 18.10 x64) even</div><div>though the default C++ version used by GCC 7.3 is C++14 as checked below:</div><div><br></div><div><div>$ g++ -dM -E -x c++  /dev/null | grep -F __cplusplus</div><div>#define __cplusplus 201402L</div></div><div><br></div><div>Note that I have not set CXX_STANDARD manually in my CMakeLists.txt so I was expecting</div><div>that my project would be compiled either with -std=gnu++14 or without any C++ version flag.</div><div>I spent some time investigating where the -std=gnu++11 flag comes from and I found that it is</div><div>related to the use of target_compile_features():</div><div><br></div><div>target_compile_features(primesieve PRIVATE cxx_auto_type)<br></div><div><br></div><div>This code tells the compiler that my program uses features from C++11 and that the compiler</div><div>should enable C++11 if the default C++ version of the compiler is e.g. C++98. I would</div><div>however expect that if the default C++ version of the compiler is > C++11 CMake would not</div><div>add -std=gnu++11 to the compiler flags.</div><div><br></div><div>For me this is a CMake bug.</div><div><br></div><div>Thanks,</div><div>Kim Walisch</div></div></div></div></div></div></div>