Merge remote-tracking branch 'suokko/cxx14_enabling' into develop (actually c++11)

develop
lethosor 2018-06-13 16:08:41 -04:00
commit 39194e5e38
3 changed files with 13 additions and 7 deletions

@ -48,7 +48,18 @@ if(WIN32)
endif() endif()
endif() endif()
# Ask for C++14 standard from compilers
set(CMAKE_CXX_STANDARD 11)
# Require the standard support from compilers.
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Use only standard c++ to keep code portable
set(CMAKE_CXX_EXTENSIONS OFF)
if(MSVC) if(MSVC)
# cmake 3.10 is first version that support msvc standard settings
if(${CMAKE_VERSION} VERSION_LESS "3.10.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11")
endif()
# disable C4819 code-page warning # disable C4819 code-page warning
add_definitions( "/wd4819" ) add_definitions( "/wd4819" )
@ -191,7 +202,7 @@ IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
add_definitions(-D_GLIBCXX_USE_C99) add_definitions(-D_GLIBCXX_USE_C99)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic -std=c++0x") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic")
IF(DFHACK_BUILD_64) IF(DFHACK_BUILD_64)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx")

@ -1,10 +1,5 @@
PROJECT(protobuf) PROJECT(protobuf)
#Protocol buffers use C++0x hash maps, so we need to look for those. This is a rewrite of stl_hash.m4 in CMake.
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ENDIF()
SET(HASH_MAP_H <unordered_map>) SET(HASH_MAP_H <unordered_map>)
SET(HASH_SET_H <unordered_map>) SET(HASH_SET_H <unordered_map>)
SET(HASH_NAMESPACE std) SET(HASH_NAMESPACE std)

@ -1,7 +1,7 @@
IF(UNIX) IF(UNIX)
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall") SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -std=c++0x") SET(CMAKE_CXX_FLAGS "-fvisibility=hidden")
SET(CMAKE_C_FLAGS "-fvisibility=hidden") SET(CMAKE_C_FLAGS "-fvisibility=hidden")
IF(DFHACK_BUILD_64) IF(DFHACK_BUILD_64)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx")