From 004e68f5a02e757c3c4d8fa833b12f3f752dc03b Mon Sep 17 00:00:00 2001 From: Andy Alt Date: Wed, 3 Oct 2018 21:18:37 -0500 Subject: [PATCH] cmake:add c++11 flag (#262) * cmake:add c++11 flag to prevent errors such as this: https://travis-ci.org/ZetaGlest/zetaglest-source/builds/436849785 --- source/shared_lib/CMakeLists.txt | 4 ++++ source/tests/CMakeLists.txt | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/shared_lib/CMakeLists.txt b/source/shared_lib/CMakeLists.txt index 65a871964..bd1806138 100644 --- a/source/shared_lib/CMakeLists.txt +++ b/source/shared_lib/CMakeLists.txt @@ -5,6 +5,10 @@ OPTION(FORCE_EMBEDDED_LIBS "Force use of embedded libraries' code." OFF) add_definitions("-DDATADIR=${INSTALL_DIR_DATA}") +# On Travis, the build fails on osx and Ubuntu trusty using +# clang 5.0 unless the -std=c++11 if used +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + if(WANT_USE_STREFLOP) # IMPORTANT: should come BEFORE finding packages find_package(PkgConfig REQUIRED) diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index 143f2bb10..1755cddcf 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -7,10 +7,9 @@ SET(TARGET_NAME "zetaglest_tests") IF(BUILD_ZETAGLEST_TESTS) MESSAGE(STATUS "Build ${TARGET_NAME} = YES") -# The tests fail on Travis with clang on osx because of the use of "bind" - if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") - endif() + # On Travis, the build fails on osx and Ubuntu trusty using + # clang 5.0 unless the -std=c++11 if used + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") INCLUDE (CheckIncludeFiles)