summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-01-13 22:21:34 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-01-13 22:21:34 +0000
commit55e6c6184ae5c018fa8fc79a9b844557fa2a0787 (patch)
tree313d6a312182b357294cb4316c02be88b18d9d1b /cmake
parentd00ec5ef7bbb323c2a98a2a5028be2ccd093d24e (diff)
downloadllvm-55e6c6184ae5c018fa8fc79a9b844557fa2a0787.tar.gz
llvm-55e6c6184ae5c018fa8fc79a9b844557fa2a0787.tar.bz2
llvm-55e6c6184ae5c018fa8fc79a9b844557fa2a0787.tar.xz
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
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/config-ix.cmake19
-rw-r--r--cmake/modules/HandleLLVMOptions.cmake16
2 files changed, 16 insertions, 19 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 7b2b005bb9..dc991a23be 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 f19d10dd16..b79ea4306e 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 )