Skip to content

Commit 25eacf7

Browse files
committed
[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... llvm-svn: 202567
1 parent 25353ac commit 25eacf7

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

llvm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ else( MSVC )
198198
option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
199199
endif()
200200

201-
option(LLVM_ENABLE_CXX11 "Compile with C++11 enabled." ON)
201+
option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF)
202202
option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF)
203203
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
204204
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,17 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
287287
if (LLVM_ENABLE_WERROR)
288288
add_llvm_definitions( -Werror )
289289
endif (LLVM_ENABLE_WERROR)
290-
if (LLVM_ENABLE_CXX11)
290+
if (LLVM_ENABLE_CXX1Y)
291+
check_cxx_compiler_flag("-std=c++1y" CXX_SUPPORTS_CXX1Y)
292+
append_if(CXX_SUPPORTS_CXX1Y "-std=c++1y" CMAKE_CXX_FLAGS)
293+
else()
291294
check_cxx_compiler_flag("-std=c++11" CXX_SUPPORTS_CXX11)
292-
append_if(CXX_SUPPORTS_CXX11 "-std=c++11" CMAKE_CXX_FLAGS)
293-
endif (LLVM_ENABLE_CXX11)
295+
if (CXX_SUPPORTS_CXX11)
296+
append("-std=c++11" CMAKE_CXX_FLAGS)
297+
else()
298+
message(FATAL_ERROR "LLVM requires C++11 support but the '-std=c++11' flag isn't supported.")
299+
endif()
300+
endif()
294301
endif( MSVC )
295302

296303
macro(append_common_sanitizer_flags)

0 commit comments

Comments
 (0)