Raphael Kubo da Costa wrote:

> Adjust the GCC feature detection code to only consider C11 support to
> exist on GCC >= 4.9.

If you do that you must remove the definition of 
CMAKE_CXX11_STANDARD_COMPILE_OPTION for GNU < 4.8.1 too.

IOW, this patch is not correct, and should not be merged.

According to

 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203066

sys/cdefs.h requires that if you use -std=c11, your compiler must have the 
c_thread_local feature. Therefore, you must not use -std=c11 with GNU < 4.9.

So, because of the apparent requirement of the FreeBSD header, if you build 
cmake with GNU < 4.9, you must configure it with CMake_NO_C_STANDARD=TRUE.

Of course, the actual bug is in sys/cdefs.h as comment #2 in 

 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203066

describes.

The __STDC_VERSION__ macro on its own (just like the __cplusplus macro on 
its own) is not suitable for feature testing. You must check the compiler 
vendor and version (or use SD-6 for C++).

Comment #3 in 

 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203066

seems strange to me, as it assumes that changing Ports packages is 
sufficient to solving the problem. Should third parties be able to build 
their code on FreeBSD? If so, then a compiler vendor and version check in 
sys/cdefs.h is the right thing to do, and I recommend getting that done.

So, in summary, there is no bug in CMake, but either your package needs to 
change (to add CMake_NO_C_STANDARD=TRUE), or sys/cdefs.h needs to change, or 
both.

Thanks,

Steve.


-- 

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:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to