arobenko / embxx

embxx - Embedded C++ Library
GNU General Public License v3.0
262 stars 35 forks source link

Compiler options - use c++11 flag #3

Closed 0xc0170 closed 8 years ago

0xc0170 commented 8 years ago

Readme states a user should use >=v4.7, which has already c++11 support (reference https://gcc.gnu.org/gcc-4.7/cxx0x_status.html). Thus I think we could switch to c++11.

As assurance, we can change this to:

if (COMPILER_SUPPORTS_CXX11)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif (COMPILER_SUPPORTS_CXX0X)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
arobenko commented 8 years ago

Does it make any real difference? When I just started the development of the library, the Ubuntu Linux LTS at that time had gcc v4.7 as its primary compiler. I suppose I can specify 4.8 as a minimal requirement. I haven't really tested the code with v4.7 for a long time.

0xc0170 commented 8 years ago

@arobenko They might mean since v4.7 the same, however I could not find the reference to this statement. I would encourage users to use c++11 as it's already 2016 :-)

I added there a check to fallback to use c++0x as I mentioned earlier. I rebased this on top of develop branch, which means there's one commit from there, if you decide to go ahead with this, cherry-pick the commit to develop, or I can reopen this to develop.

ajneu commented 8 years ago

See https://github.com/arobenko/embxx/pull/6#issue-136527558 for a recommended way of settings C++11 in cmake using CMAKE_CXX_STANDARD and CMAKE_CXX_EXTENSIONS.

0xc0170 commented 8 years ago

@ajneu Cool, I'll close this one