Page 1 of 1

CEGUI Default Branch Standard = C++11 or gnu++11 ?

Posted: Wed Oct 14, 2015 15:31
by iceiceice
In the Default branch cmake script for CEGUI, the C++11 standard is selected in this block of code

Code: Select all

if ((CMAKE_C_COMPILER_ID STREQUAL "GNU") OR (CMAKE_C_COMPILER_ID STREQUAL "Clang"))
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
elseif (NOT CMAKE_VERSION VERSION_LESS "3.1")
    set (CMAKE_C_STANDARD_REQUIRED TRUE)
    set (CMAKE_C_STANDARD "11")
endif ()
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
elseif (NOT CMAKE_VERSION VERSION_LESS "3.1")
    set (CMAKE_CXX_STANDARD_REQUIRED TRUE)
    set (CMAKE_CXX_STANDARD "11")
endif ()


This makes it so that if CEGUI is compiled with gcc or clang, the gcc-specific compiler extensions will be enabled.
Some projects would prefer not to enable these extensions, because, some of them conflict with the official standard, and others,
might not be supported by other compilers. If people want to statically link CEGUI into their project and it only compiles with
these extensions, though, then they might be forced to change compilers to something that supports these extensions.

Does CEGUI actually use these extensions?
If not, can I request or suggest that we make it `std=c++11` instead of `gnu++11 ` above?

Re: CEGUI Default Branch Standard = C++11 or gnu++11 ?

Posted: Wed Oct 14, 2015 15:47
by YaronCT
I agree that as long as we don't need GCC's extensions we might as well go with "-std=c++11" for C++ and "-std=c11" for C.

Re: CEGUI Default Branch Standard = C++11 or gnu++11 ?

Posted: Wed Oct 14, 2015 18:01
by timotei
+1 On using standard C++11. I don't see why we'd use GNU++11, since we aim at being cross-platfom

Re: CEGUI Default Branch Standard = C++11 or gnu++11 ?

Posted: Sun Oct 25, 2015 07:15
by YaronCT
Well, if there's no objection, I'll make the change. I'll also make branches "v0-8" and "v0" explicitly use the C++03/C99 standard. I'm not sure it's necessary, but it wouldn't hurt.

Re: CEGUI Default Branch Standard = C++11 or gnu++11 ?

Posted: Sun Nov 01, 2015 19:21
by Ident
It got merged.