diff --git a/CMakeLists.txt b/CMakeLists.txt index cc64080b3b5cff6f06f4fb73422d4443258ae877..6ba4af0f76cf8cb355d5941fb844f105ba0e943a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,7 @@ opt(CGNS "Enable CGNS mesh export (experimental)" OFF) opt(CAIRO "Enable Cairo to render fonts (experimental)" ${DEFAULT}) opt(CHACO "Enable Chaco mesh partitioner (alternative to Metis)" ${DEFAULT}) opt(COMPRESSED_IO "Enable compressed (gzip) input/output using zlib" OFF) -opt(CXX11 "Compile with -std=c++11" OFF) +opt(CXX11 "Enable C++11" ${DEFAULT}) opt(DINTEGRATION "Enable discrete integration (needed for levelsets)" ${DEFAULT}) opt(FLTK "Enable FLTK graphical user interface (requires mesh/post)" ${DEFAULT}) opt(FOURIER_MODEL "Enable Fourier geometrical models (experimental)" OFF) @@ -246,7 +246,11 @@ endif(ENABLE_OPENMP) if(ENABLE_CXX11) # in recent cmake versions we could do e.g. set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + check_cxx_compiler_flag("-std=c++11" STDCXX11) + if(STDCXX11) + set_config_option(HAVE_CXX11 "C++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif(STDCXX11) endif(ENABLE_CXX11) macro(append_gmsh_src DIRNAME FILES)