|
| 1 | +################################################################################ |
| 2 | +# Copyright 1998-2020 by authors (see AUTHORS.txt) |
| 3 | +# |
| 4 | +# This file is part of LuxCoreRender. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +################################################################################ |
| 18 | + |
| 19 | +message(STATUS "Checking compiler version...") |
| 20 | + |
| 21 | +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
| 22 | + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0) |
| 23 | + message(FATAL_ERROR "GCC >= 14.0 is required, found ${CMAKE_CXX_COMPILER_VERSION}") |
| 24 | + endif() |
| 25 | + |
| 26 | +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
| 27 | + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20.0) |
| 28 | + message(FATAL_ERROR "Clang/LLVM >= 20.0 is required, found ${CMAKE_CXX_COMPILER_VERSION}") |
| 29 | + endif() |
| 30 | + |
| 31 | +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
| 32 | + # MSVC_VERSION is in a weird format: e.g. 1929 -> Visual Studio 2019 version 16.9 |
| 33 | + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.40) |
| 34 | + message(FATAL_ERROR "MSVC >= 19.40 (at least Visual Studio 2022 version 17.10) is required, found ${CMAKE_CXX_COMPILER_VERSION}") |
| 35 | + endif() |
| 36 | + |
| 37 | +else() |
| 38 | + message(WARNING "Unknown compiler '${CMAKE_CXX_COMPILER_ID}', skipping version check.") |
| 39 | +endif() |
0 commit comments