From: Chandler Carruth Date: Mon, 13 Jan 2014 22:21:34 +0000 (+0000) Subject: Factor the option and checking of compiler version better. Put the X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=55e6c6184ae5c018fa8fc79a9b844557fa2a0787 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 06f4335f135..c689dca3b57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 7b2b005bb9f..dc991a23be0 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -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) diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index f19d10dd162..b79ea4306eb 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -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 )