[llvm] r202567 - [C++11] Switch the CMake option from LLVM_ENABLE_CXX11 (default on) to

Chandler Carruth chandlerc at gmail.com
Fri Feb 28 19:16:07 PST 2014


Author: chandlerc
Date: Fri Feb 28 21:16:07 2014
New Revision: 202567

URL: http://llvm.org/viewvc/llvm-project?rev=202567&view=rev
Log:
[C++11] Switch the CMake option from LLVM_ENABLE_CXX11 (default on) to
LLVM_ENABLE_CXX1Y (default *off*). =D C++98 is dead. Long live C++11.

I don't exactly recommend using C++1y just yet though...

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=202567&r1=202566&r2=202567&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Fri Feb 28 21:16:07 2014
@@ -198,7 +198,7 @@ else( MSVC )
   option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
 endif()
 
-option(LLVM_ENABLE_CXX11 "Compile with C++11 enabled." ON)
+option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF)
 option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF)
 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=202567&r1=202566&r2=202567&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Fri Feb 28 21:16:07 2014
@@ -287,10 +287,17 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE
   if (LLVM_ENABLE_WERROR)
     add_llvm_definitions( -Werror )
   endif (LLVM_ENABLE_WERROR)
-  if (LLVM_ENABLE_CXX11)
+  if (LLVM_ENABLE_CXX1Y)
+    check_cxx_compiler_flag("-std=c++1y" CXX_SUPPORTS_CXX1Y)
+    append_if(CXX_SUPPORTS_CXX1Y "-std=c++1y" CMAKE_CXX_FLAGS)
+  else()
     check_cxx_compiler_flag("-std=c++11" CXX_SUPPORTS_CXX11)
-    append_if(CXX_SUPPORTS_CXX11 "-std=c++11" CMAKE_CXX_FLAGS)
-  endif (LLVM_ENABLE_CXX11)
+    if (CXX_SUPPORTS_CXX11)
+      append("-std=c++11" CMAKE_CXX_FLAGS)
+    else()
+      message(FATAL_ERROR "LLVM requires C++11 support but the '-std=c++11' flag isn't supported.")
+    endif()
+  endif()
 endif( MSVC )
 
 macro(append_common_sanitizer_flags)





More information about the llvm-commits mailing list