summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Slattery <theslat@gmail.com>2018-11-08 00:24:17 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-15 18:58:53 (GMT)
commit7414d422b267718e737637fefa01b94502febb0e (patch)
tree3dd4e4aef81ba13ef6a9e74ba8f19cecc9ef2f5f
parentda566d4de885130e182edc80f13691f5ca24bb61 (diff)
downloadCMake-7414d422b267718e737637fefa01b94502febb0e.zip
CMake-7414d422b267718e737637fefa01b94502febb0e.tar.gz
CMake-7414d422b267718e737637fefa01b94502febb0e.tar.bz2
IAR: Parse INFO strings from the binary format of AVR systems
Teach `CMakeDetermineCompilerId` to recognize and parse the IAR-AVR binary format so we can recognize this compiler id. Issue: #18557
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 050d3e7..f987d9a 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -523,7 +523,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
file(STRINGS ${file}
CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 38
${CMAKE_${lang}_COMPILER_ID_STRINGS_PARAMETERS}
- REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]")
set(COMPILER_ID_TWICE)
# With the IAR Compiler, some strings are found twice, first time as incomplete
# list like "?<Constant "INFO:compiler[IAR]">". Remove the incomplete copies.
@@ -531,6 +531,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
# In C# binaries, some strings are found more than once.
list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_ID_STRINGS)
foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
+ # The IAR-AVR compiler uses a binary format that places a '6'
+ # character (0x34) before each character in the string. Strip
+ # out these characters without removing any legitamate characters.
+ if("${info}" MATCHES "(.)I.N.F.O.:.")
+ string(REGEX REPLACE "${CMAKE_MATCH_1}(.)" "\\1" info "${info}")
+ endif()
if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]")
if(COMPILER_ID)
set(COMPILER_ID_TWICE 1)