| # SPDX-License-Identifier: Apache-2.0 |
| # ---------------------------------------------------------------------------- |
| # Copyright 2020-2025 Arm Limited |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy |
| # of the License at: |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations |
| # under the License. |
| # ---------------------------------------------------------------------------- |
| |
| # On CMake 3.25 or older CXX_COMPILER_FRONTEND_VARIANT is not always set |
| if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "") |
| set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "${CMAKE_CXX_COMPILER_ID}") |
| endif() |
| |
| # Compiler accepts MSVC-style command line options |
| set(is_msvc_fe "$<STREQUAL:${CMAKE_CXX_COMPILER_FRONTEND_VARIANT},MSVC>") |
| # Compiler accepts GNU-style command line options |
| set(is_gnu_fe1 "$<STREQUAL:${CMAKE_CXX_COMPILER_FRONTEND_VARIANT},GNU>") |
| # Compiler accepts AppleClang-style command line options, which is also GNU-style |
| set(is_gnu_fe2 "$<STREQUAL:${CMAKE_CXX_COMPILER_FRONTEND_VARIANT},AppleClang>") |
| # Compiler accepts GNU-style command line options |
| set(is_gnu_fe "$<OR:${is_gnu_fe1},${is_gnu_fe2}>") |
| |
| # Compiler is Visual Studio cl.exe |
| set(is_msvccl "$<AND:${is_msvc_fe},$<CXX_COMPILER_ID:MSVC>>") |
| # Compiler is Visual Studio clangcl.exe |
| set(is_clangcl "$<AND:${is_msvc_fe},$<CXX_COMPILER_ID:Clang>>") |
| # Compiler is upstream clang with the standard frontend |
| set(is_clang "$<AND:${is_gnu_fe},$<CXX_COMPILER_ID:Clang,AppleClang>>") |