From 76a241dea6905f242c0758cbc6b1121356fdb0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Fri, 9 Apr 2021 12:35:30 +0200 Subject: [PATCH] [CMAKE] Also set GCC/CLANG variables on amd64 builds --- sdk/cmake/config-amd64.cmake | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sdk/cmake/config-amd64.cmake b/sdk/cmake/config-amd64.cmake index 110a0f218af..01ef763c719 100644 --- a/sdk/cmake/config-amd64.cmake +++ b/sdk/cmake/config-amd64.cmake @@ -44,3 +44,22 @@ set(_PREFAST_ FALSE CACHE BOOL cmake_dependent_option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON "CMAKE_BUILD_TYPE STREQUAL Debug" OFF) endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + set(GCC TRUE CACHE BOOL "The compiler is GCC") + set(CLANG FALSE CACHE BOOL "The compiler is LLVM Clang") +elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang") + # We can use LLVM Clang mimicking CL or GCC. Account for this + if (MSVC) + set(GCC FALSE CACHE BOOL "The compiler is GCC") + else() + set(GCC TRUE CACHE BOOL "The compiler is GCC") + endif() + set(CLANG TRUE CACHE BOOL "The compiler is LLVM Clang") +elseif(MSVC) # aka CMAKE_C_COMPILER_ID STEQUAL "MSVC" + set(GCC FALSE CACHE BOOL "The compiler is GCC") + set(CLANG FALSE CACHE BOOL "The compiler is LLVM Clang") + # MSVC variable is already set by cmake +else() + message("WARNING: the compiler has not been recognized") +endif()