Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / hana / cmake / CheckCxxCompilerSupport.cmake
1 # Copyright Louis Dionne 2013-2017
2 # Copyright Markus J. Weber 2015
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
5 #
6 #
7 # This CMake module checks whether the current compiler is supported, and
8 # provides friendly hints to the user.
9
10 if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
11     if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "3.9.1")
12         message(WARNING "
13     ### You appear to be using Clang ${CMAKE_CXX_COMPILER_VERSION}, which is known
14     ### to be unable to compile Hana. Consider switching to
15     ### Clang >= 3.9.1. If it is already installed on your
16     ### system, you can tell CMake about it with
17     ###
18     ###     cmake .. -DCMAKE_CXX_COMPILER=/path/to/clang
19         ")
20     endif()
21
22     if (MSVC)
23         if(${MSVC_VERSION} LESS 1900)
24             message(WARNING "
25     ###
26     ### We detected that you were using Clang for Windows with a
27     ### -fms-compatibility-version parameter lower than 19. Only
28     ### -fms-compatibility-version=19 and above are supported by
29     ### Hana for lack of proper C++14 support prior for versions
30     ### below that.
31     ###
32     ### If this diagnostic is wrong and you are not using
33     ### -fms-compatibility-version, please file an issue at
34     ### https://github.com/boostorg/hana/issues.
35     ###
36             ")
37         endif()
38     endif()
39 elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang")
40     if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "6.1.0")
41         message(WARNING "
42     ### You appear to be using Apple's Clang ${CMAKE_CXX_COMPILER_VERSION}, which is
43     ### shipped with Xcode < 6.3. Unfortunately, only Apple's Clang
44     ### >= 6.1.0 (shipped with Xcode >= 6.3) can compile Hana.
45     ### You should consider updating to Xcode >= 6.3 (requires Yosemite)
46     ### or using a non-Apple Clang >= 3.9.1, which can be installed via
47     ### Homebrew with
48     ###
49     ###     brew install llvm --with-clang
50     ###
51     ### You can then tell CMake to use that non-system Clang with
52     ###
53     ###     cmake .. -DCMAKE_CXX_COMPILER=/path/to/clang
54         ")
55     endif()
56 elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
57     if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "6.0.0")
58         message(WARNING "
59     ### You appear to be using GCC ${CMAKE_CXX_COMPILER_VERSION}, which is known to be
60     ### unable to compile Hana. Only GCC >= 6.0.0 is supported.
61     ### Consider using a more recent GCC or switching to Clang.
62     ### If a more recent compiler is already installed on your
63     ### system, you can tell CMake to use it with
64     ###
65     ###     cmake .. -DCMAKE_CXX_COMPILER=/path/to/compiler
66         ")
67     endif()
68 elseif (MSVC)
69     message(WARNING "
70     ### Using the native Microsoft compiler (MSVC) is not supported for lack
71     ### of proper C++14 support. However, you can install pre-built Clang for
72     ### Windows binaries (with Visual Studio integration if desired) at
73     ### http://llvm.org/releases/download.html.
74     ###
75     ### More information about how to set up Hana with Clang for Windows is
76     ### available on Hana's wiki at http://git.io/vBYIp.
77     ")
78 else()
79     message(WARNING "
80     ### You appear to be using a compiler that is not yet tested with Hana.
81     ### Please tell us whether it successfully compiles or if and how it
82     ### fails by opening an issue at https://github.com/boostorg/hana/issues.
83     ### Thanks!
84     ")
85 endif()