CheckCxxCompilerSupport.cmake 3.4 KB

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