Factor the option and checking of compiler version better. Put the
authorChandler Carruth <chandlerc@gmail.com>
Mon, 13 Jan 2014 22:21:34 +0000 (22:21 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 13 Jan 2014 22:21:34 +0000 (22:21 +0000)
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

CMakeLists.txt
cmake/config-ix.cmake
cmake/modules/HandleLLVMOptions.cmake

index 06f4335f135e39e751042655005b0fc3f5e5bb83..c689dca3b5701d54d6f5da01088e968ac5031759 100644 (file)
@@ -195,6 +195,9 @@ else()
   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
 endif()
 
+option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
+       "Set to ON to force using an old, unsupported host toolchain." OFF)
+
 option(LLVM_USE_INTEL_JITEVENTS
   "Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code"
   OFF)
index 7b2b005bb9f5ed2dca4a04c5adef660ec75ecdc4..dc991a23be075ad3554717c0218bbb594d158775 100755 (executable)
@@ -316,25 +316,6 @@ if (LIBXML2_FOUND)
   endif ()
 endif ()
 
-option(LLVM_FORCE_USE_OLD_TOOLCHAIN
-       "Set to ON if you want to force CMake to use a toolchain older than those supported by LLVM."
-       OFF)
-if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN)
-  if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
-      message(FATAL_ERROR "Host GCC version must be at least 4.7!")
-    endif()
-  elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
-    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
-      message(FATAL_ERROR "Host Clang version must be at least 3.1!")
-    endif()
-  elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
-    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0)
-      message(FATAL_ERROR "Host Visual Studio must be at least 2012 (MSVC 17.0)")
-    endif()
-  endif()
-endif()
-
 include(CheckCXXCompilerFlag)
 
 check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
index f19d10dd162dd64b43ad5b7a009184f5de49e71d..b79ea4306ebc9090dda799db041ba5c02d473a7d 100644 (file)
@@ -14,6 +14,22 @@ elseif( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
   set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
 endif()
 
+if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN)
+  if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+      message(FATAL_ERROR "Host GCC version must be at least 4.7!")
+    endif()
+  elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1)
+      message(FATAL_ERROR "Host Clang version must be at least 3.1!")
+    endif()
+  elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+    if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0)
+      message(FATAL_ERROR "Host Visual Studio must be at least 2012 (MSVC 17.0)")
+    endif()
+  endif()
+endif()
+
 if( LLVM_ENABLE_ASSERTIONS )
   # MSVC doesn't like _DEBUG on release builds. See PR 4379.
   if( NOT MSVC )