Only set C++11 explicitly for old versions of GCC. (#1724)

Starting with GCC 6.1, C++14 became the default.

Signed-off-by: Wolfgang Hess <whess@lyft.com>
master
Wolfgang Hess 2020-07-23 11:46:59 +02:00 committed by GitHub
parent a62fb739af
commit 3611b52e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -76,7 +76,11 @@ macro(google_initialize_cartographer_project)
if(WIN32) if(WIN32)
# TODO turn on equivalent warnings on Windows # TODO turn on equivalent warnings on Windows
else() else()
set(GOOG_CXX_FLAGS "-pthread -std=c++11 -fPIC ${GOOG_CXX_FLAGS}") set(GOOG_CXX_FLAGS "-pthread -fPIC ${GOOG_CXX_FLAGS}")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
google_add_flag(GOOG_CXX_FLAGS "-std=c++11")
endif()
google_add_flag(GOOG_CXX_FLAGS "-Wall") google_add_flag(GOOG_CXX_FLAGS "-Wall")
google_add_flag(GOOG_CXX_FLAGS "-Wpedantic") google_add_flag(GOOG_CXX_FLAGS "-Wpedantic")