CMake: explicitly require C++11 support
Explicitly require C++11 support to be able to compile terragear on older systems.
This commit is contained in:
parent
95a34ae32a
commit
5b5e5fc0cc
2 changed files with 14 additions and 1 deletions
|
@ -6,6 +6,11 @@ include (CheckCXXSourceCompiles)
|
|||
include (CheckIncludeFile)
|
||||
include (CPack)
|
||||
|
||||
# let's use & require C++11 - note these are only functional with CMake 3.1
|
||||
# we do manual fallbacks for CMake 3.0 in the compilers section
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
|
||||
project(TerraGear)
|
||||
|
||||
# read 'version' file into a variable (stripping any newlines or spaces)
|
||||
|
@ -27,7 +32,6 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||
FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
|
||||
if (MSVC)
|
||||
GET_FILENAME_COMPONENT(PARENT_DIR ${PROJECT_SOURCE_DIR} PATH)
|
||||
if (CMAKE_CL_64)
|
||||
|
@ -126,6 +130,10 @@ set(PKGDATADIR ${CMAKE_INSTALL_PREFIX}/share/TerraGear)
|
|||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(WARNING_FLAGS -Wall)
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS 3.1)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif()
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if(WIN32)
|
||||
|
|
|
@ -187,6 +187,11 @@ unset(SIMGEAR_COMPILE_TEST CACHE)
|
|||
|
||||
# disable OSG dependencies for test-compiling
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "-DNO_OPENSCENEGRAPH_INTERFACE")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
|
||||
check_cxx_source_runs(
|
||||
"#include <cstdio>
|
||||
#include \"simgear/version.h\"
|
||||
|
|
Loading…
Add table
Reference in a new issue