aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindCXX11.cmake
blob: c0b9a52d20d71c992062cada1dfb54255d77595f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
include(TestCXXAcceptsFlag)

# try to use compiler flag -std=c++11
check_cxx_accepts_flag("-std=c++11" CXX_FLAG_CXX11)
if(CXX_FLAG_CXX11)
  add_options (CXX ALL_BUILDS "-std=c++11")
  set(CXX_STD11_FLAGS "-std=c++11")
else()
  # try to use compiler flag -std=c++0x for older compilers
  check_cxx_accepts_flag("-std=c++0x" CXX_FLAG_CXX0X)
  if(CXX_FLAG_CXX0X)
    add_options (CXX ALL_BUILDS "-std=c++0x")
    set(CXX_STD11_FLAGS "-std=c++0x")
  endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CXX11 DEFAULT_MSG CXX_STD11_FLAGS)