From 3b365c461fc2536f731435832f8a3f05b2c64854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20L=C3=B6nnberg?= Date: Tue, 21 Feb 2023 10:15:14 +0100 Subject: IAR: Tolerate variables named for languages If a project or user sets a variable or cache entry named `C` or `CXX`, we were previously comparing those language names to the value of that variable, rather than the name itself. Double-quote the string to take advantage of policy `CMP0054`, but also add "x" prefixes to support projects that do not set the policy. This extends a similar fix from commit c8eb357738 (CompilerId: Tolerate variables named for languages, 2021-06-17, v3.21.0-rc1~9^2). --- Modules/Compiler/IAR.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Compiler/IAR.cmake b/Modules/Compiler/IAR.cmake index 7908f96..e75df59 100644 --- a/Modules/Compiler/IAR.cmake +++ b/Modules/Compiler/IAR.cmake @@ -9,7 +9,7 @@ include_guard() macro(__compiler_iar_common lang) - if (${lang} MATCHES "^(C|CXX)$") + if ("x${lang}" MATCHES "^x(C|CXX)$") set(CMAKE_${lang}_COMPILE_OBJECT " ${CMAKE_IAR_${lang}_FLAG} --silent -o ") set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " ${CMAKE_IAR_${lang}_FLAG} --silent --preprocess=cnl ") set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " ${CMAKE_IAR_${lang}_FLAG} --silent -lAH -o .dummy") -- cgit v0.12