Skip to content

Commit

Permalink
Added workaround in CMakeLists.txt to handle different C++11 compiler…
Browse files Browse the repository at this point in the history
… flags.
  • Loading branch information
m0r13 committed Dec 4, 2014
1 parent 5024bb4 commit ddd6ea7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Expand Up @@ -29,7 +29,18 @@ if(OPT_PROFILE)
endif()

add_definitions(-Wall)
add_definitions(-std=c++0x)

# http://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
add_definitions(-std=c++11)
elseif(COMPILER_SUPPORTS_CXX0X)
add_definitions(-std=c++0x)
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

if(OPT_LINK_BOOST_STATICALLY)
set(Boost_USE_STATIC_LIBS ON)
Expand Down

0 comments on commit ddd6ea7

Please sign in to comment.