set -std=gnu++11 globally for C++ only

Add -std=gnu+11 to CMAKE_CXX_COMPILE_OBJECT in the main CMakeLists.txt
to force the option for all C++ sources.

The right way to do this is to use a generator expression with
ADD_COMPILE_OPTIONS, but this is only available in cmake 3.3 and we must
maintain 2.8.12 compatibility to support Ubuntu 14.

This fixes the mac build (clang.)
This commit is contained in:
Rafael Kitover 2017-02-11 05:33:10 -08:00
parent 2dc673c753
commit b4ba9d9d65
2 changed files with 5 additions and 8 deletions

View File

@ -330,10 +330,6 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
ENDIF()
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(MY_C_FLAGS ${MY_C_FLAGS} -std=gnu++11)
ENDIF()
IF(MINGW)
SET(MY_C_FLAGS ${MY_C_FLAGS} -static-libgcc -static-libstdc++)
ENDIF(MINGW)
@ -348,6 +344,11 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
ADD_COMPILE_OPTIONS(${C_COMPILE_FLAG})
ENDFOREACH()
# This one must be set for C++ only, and we can't use generator expressions
# in ADD_COMPILE_OPTIONS because that's a cmake 3.3 feature and we need
# 2.8.12 compat for Ubuntu 14.
SET(CMAKE_CXX_COMPILE_OBJECT "${CMAKE_CXX_COMPILE_OBJECT} -std=gnu++11")
# make a string of compile options to add to link flags
UNSET(C_COMPILE_FLAGS_STR)

View File

@ -3,10 +3,6 @@
cmake_policy(SET CMP0043 NEW) # for wxWidgets
IF(CMAKE_COMPILER_IS_GNUCXX)
SET( CMAKE_CXX_FLAGS -std=gnu++11 )
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
# not yet implemented
SET(CAIRO_DEFAULT OFF)