Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 55e6c61

Browse files
committed
Factor the option and checking of compiler version better. Put the
option with the others in the top level CMakeLists, and put the check in HandleLLVMOptions. This will also let it be used from the standalone Clang builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199149 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent d00ec5e commit 55e6c61

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ else()
195195
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
196196
endif()
197197

198+
option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
199+
"Set to ON to force using an old, unsupported host toolchain." OFF)
200+
198201
option(LLVM_USE_INTEL_JITEVENTS
199202
"Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code"
200203
OFF)

cmake/config-ix.cmake

-19
Original file line numberDiff line numberDiff line change
@@ -316,25 +316,6 @@ if (LIBXML2_FOUND)
316316
endif ()
317317
endif ()
318318

319-
option(LLVM_FORCE_USE_OLD_TOOLCHAIN
320-
"Set to ON if you want to force CMake to use a toolchain older than those supported by LLVM."
321-
OFF)
322-
if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN)
323-
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
324-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
325-
message(FATAL_ERROR "Host GCC version must be at least 4.7!")
326-
endif()
327-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
328-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
329-
message(FATAL_ERROR "Host Clang version must be at least 3.1!")
330-
endif()
331-
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
332-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0)
333-
message(FATAL_ERROR "Host Visual Studio must be at least 2012 (MSVC 17.0)")
334-
endif()
335-
endif()
336-
endif()
337-
338319
include(CheckCXXCompilerFlag)
339320

340321
check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)

cmake/modules/HandleLLVMOptions.cmake

+16
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
1414
set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
1515
endif()
1616

17+
if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN)
18+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
19+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
20+
message(FATAL_ERROR "Host GCC version must be at least 4.7!")
21+
endif()
22+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
23+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
24+
message(FATAL_ERROR "Host Clang version must be at least 3.1!")
25+
endif()
26+
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
27+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0)
28+
message(FATAL_ERROR "Host Visual Studio must be at least 2012 (MSVC 17.0)")
29+
endif()
30+
endif()
31+
endif()
32+
1733
if( LLVM_ENABLE_ASSERTIONS )
1834
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
1935
if( NOT MSVC )

0 commit comments

Comments
 (0)