瀏覽代碼

Features: Use the correct dialect flag when recording features.

Avoid using -std=c++1y for compilers which support -std=c++14, for
example.
Stephen Kelly 11 年之前
父節點
當前提交
82c283f914
共有 4 個文件被更改,包括 16 次插入16 次删除
  1. 4 4
      Modules/Compiler/Clang-C.cmake
  2. 4 4
      Modules/Compiler/Clang-CXX.cmake
  3. 4 4
      Modules/Compiler/GNU-C.cmake
  4. 4 4
      Modules/Compiler/GNU-CXX.cmake

+ 4 - 4
Modules/Compiler/Clang-C.cmake

@@ -21,16 +21,16 @@ set(CMAKE_C_STANDARD_DEFAULT 90)
 
 macro(cmake_record_c_compile_features)
   macro(_get_clang_features std_version list)
-    record_compiler_features(C "-std=${std_version}" ${list})
+    record_compiler_features(C "${std_version}" ${list})
   endmacro()
 
   if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
-    _get_clang_features(c11 CMAKE_C11_COMPILE_FEATURES)
+    _get_clang_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
     if (_result EQUAL 0)
-      _get_clang_features(c99 CMAKE_C99_COMPILE_FEATURES)
+      _get_clang_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
     endif()
     if (_result EQUAL 0)
-      _get_clang_features(c90 CMAKE_C90_COMPILE_FEATURES)
+      _get_clang_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
     endif()
   else()
     set(_result 0)

+ 4 - 4
Modules/Compiler/Clang-CXX.cmake

@@ -35,16 +35,16 @@ set(CMAKE_CXX_STANDARD_DEFAULT 98)
 
 macro(cmake_record_cxx_compile_features)
   macro(_get_clang_features std_version list)
-    record_compiler_features(CXX "-std=${std_version}" ${list})
+    record_compiler_features(CXX "${std_version}" ${list})
   endmacro()
 
   if (UNIX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
-    _get_clang_features(c++1y CMAKE_CXX14_COMPILE_FEATURES)
+    _get_clang_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
     if (_result EQUAL 0)
-      _get_clang_features(c++11 CMAKE_CXX11_COMPILE_FEATURES)
+      _get_clang_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
     endif()
     if (_result EQUAL 0)
-      _get_clang_features(c++98 CMAKE_CXX98_COMPILE_FEATURES)
+      _get_clang_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
     endif()
   else()
     set(_result 0)

+ 4 - 4
Modules/Compiler/GNU-C.cmake

@@ -17,16 +17,16 @@ set(CMAKE_C_STANDARD_DEFAULT 90)
 
 macro(cmake_record_c_compile_features)
   macro(_get_gcc_features std_version list)
-    record_compiler_features(C "-std=${std_version}" ${list})
+    record_compiler_features(C "${std_version}" ${list})
   endmacro()
 
   if (UNIX AND NOT APPLE AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
-    _get_gcc_features(c11 CMAKE_C11_COMPILE_FEATURES)
+    _get_gcc_features(${CMAKE_C11_STANDARD_COMPILE_OPTION} CMAKE_C11_COMPILE_FEATURES)
     if (_result EQUAL 0)
-      _get_gcc_features(c99 CMAKE_C99_COMPILE_FEATURES)
+      _get_gcc_features(${CMAKE_C99_STANDARD_COMPILE_OPTION} CMAKE_C99_COMPILE_FEATURES)
     endif()
     if (_result EQUAL 0)
-      _get_gcc_features(c90 CMAKE_C90_COMPILE_FEATURES)
+      _get_gcc_features(${CMAKE_C90_STANDARD_COMPILE_OPTION} CMAKE_C90_COMPILE_FEATURES)
     endif()
   else()
     set(_result 0)

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

@@ -33,19 +33,19 @@ set(CMAKE_CXX_STANDARD_DEFAULT 98)
 
 macro(cmake_record_cxx_compile_features)
   macro(_get_gcc_features std_version list)
-    record_compiler_features(CXX "-std=${std_version}" ${list})
+    record_compiler_features(CXX "${std_version}" ${list})
   endmacro()
 
   set(_result 0)
   if (UNIX AND NOT APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
-    _get_gcc_features(c++1y CMAKE_CXX14_COMPILE_FEATURES)
+    _get_gcc_features(${CMAKE_CXX14_STANDARD_COMPILE_OPTION} CMAKE_CXX14_COMPILE_FEATURES)
   endif()
   if (UNIX AND NOT APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
     if (_result EQUAL 0)
-      _get_gcc_features(c++11 CMAKE_CXX11_COMPILE_FEATURES)
+      _get_gcc_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
     endif()
     if (_result EQUAL 0)
-      _get_gcc_features(c++98 CMAKE_CXX98_COMPILE_FEATURES)
+      _get_gcc_features(${CMAKE_CXX98_STANDARD_COMPILE_OPTION} CMAKE_CXX98_COMPILE_FEATURES)
     endif()
   else()
     set(_result 0)