diff options
| author | Alex Merry <kde@randomguy3.me.uk> | 2014-01-28 23:14:52 +0000 | 
|---|---|---|
| committer | Alex Merry <kde@randomguy3.me.uk> | 2014-01-29 17:25:38 +0000 | 
| commit | dc3e32e27dcd42f551e5fb2c923689275c6b3f52 (patch) | |
| tree | 1e5697fe0990fbdb12986c783c273dfb3cc2f2e4 | |
| parent | eed522877d4b575e2bbfdcca7dc964df6b88030e (diff) | |
| download | extra-cmake-modules-dc3e32e27dcd42f551e5fb2c923689275c6b3f52.tar.gz extra-cmake-modules-dc3e32e27dcd42f551e5fb2c923689275c6b3f52.tar.bz2 | |
Improve the compiler version checks
- Only warn if the compiler is not recent enough (it may still work...)
- Bump up the GCC version to 4.5 (on Linux, at least) to match Qt
- Add checks for Windows (both MSVC and MinGW)
- Add check for Clang
REVIEW: 115372
| -rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 36 | 
1 files changed, 33 insertions, 3 deletions
| diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 92d1f823..335e1270 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -27,12 +27,42 @@  ############################################################  # Toolchain minimal requirements +# +# Note that only compilers officially supported by Qt are +# supported by this file; workarounds for older compilers +# will generally not be included.  See +# https://qt-project.org/doc/qt-5/supported-platforms.html +# and +# https://community.kde.org/Frameworks/Policies#Frameworks_compiler_requirements_and_C.2B.2B11 +# for more details.  ############################################################ -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") -    if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.2.0") -        message(FATAL_ERROR "GCC 4.2 or later is required") +macro(_kde_compiler_min_version min_version) +    if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "${min_version}") +        message(WARNING "Version ${CMAKE_CXX_COMPILER_VERSION} of the ${CMAKE_CXX_COMPILER_ID} C++ compiler is not supported. Please use version ${min_version} or later.") +    endif() +endmacro() + +if (MSVC) +    # MSVC_VERSION 1600 = VS 10.0 = Windows SDK 7 +    # See: cmake --help-variable MSVC_VERSION +    # and https://developer.mozilla.org/en-US/docs/Windows_SDK_versions +    if (${MSVC_VERSION} LESS 1600) +        message(WARNING "Your MSVC version (${MSVC_VERSION}) is not supported. Please use the Windows SDK version 7 or later (or Microsoft Visual Studio 2010 or later).") +    endif() +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") +    if (WIN32) +        _kde_compiler_min_version("4.7") +    elseif (APPLE) +        # FIXME: Apple heavily modifies GCC, so checking the +        # GCC version on OS/X is not very useful. +    else() +        _kde_compiler_min_version("4.5")      endif() +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +    _kde_compiler_min_version("3.1") +else() +    message(WARNING "${CMAKE_CXX_COMPILER_ID} is not a supported C++ compiler.")  endif() | 
