Browse Source

Features: Use -std=c++17 for C++ 17 on GNU 8.0+

GNU 8 now documents official support for the `-std=c++17` flag.
Brad King 7 years ago
parent
commit
0bc3e5788a
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Modules/Compiler/GNU-CXX.cmake

+ 4 - 1
Modules/Compiler/GNU-CXX.cmake

@@ -33,7 +33,10 @@ elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
   set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
 endif()
 
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
+  set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+  set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
   set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
   set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
 endif()