From 1ee99104f76ccd831713816eec588eb5d7e93f8b Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 3 Dec 2020 14:33:11 -0500 Subject: CMakeDetermineCompilerId: Filter IAR-AVR format INFO strings earlier Remove the bytes between characters from the entire list at once. --- Modules/CMakeDetermineCompilerId.cmake | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index a982d2c..ca82d8a 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -756,15 +756,16 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) # With the IAR Compiler, some strings are found twice, first time as incomplete # list like "?". Remove the incomplete copies. list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\? Date: Thu, 3 Dec 2020 14:36:19 -0500 Subject: CMakeDetermineCompilerId: Add whitespace to clarify logic Also initialize a variable closer to its use. --- Modules/CMakeDetermineCompilerId.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index ca82d8a..d586275 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -752,10 +752,11 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) break() endif() endforeach() - set(COMPILER_ID_TWICE) + # With the IAR Compiler, some strings are found twice, first time as incomplete # list like "?". Remove the incomplete copies. list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\? Date: Thu, 3 Dec 2020 14:35:15 -0500 Subject: CMakeDetermineCompilerId: Tolerate stray text around INFO strings When cross-compiling with Xcode our compiler id test binary may be compiled with multiple architectures. The INFO strings should be identical and therefore de-duplicated. However, this can be broken by stray text that happens to sit immediately before or after an INFO string. Filter out such text so we can match clean INFO strings. Fixes: #21526 --- Modules/CMakeDetermineCompilerId.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index d586275..937a120 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -765,6 +765,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) CMAKE_${lang}_COMPILER_ID_STRINGS "${CMAKE_${lang}_COMPILER_ID_STRINGS}") endif() + # Remove arbitrary text that may appear before or after each INFO string. + string(REGEX MATCHALL "INFO:[A-Za-z0-9_]+\\[([^]\"]*)\\]" + CMAKE_${lang}_COMPILER_ID_STRINGS "${CMAKE_${lang}_COMPILER_ID_STRINGS}") + # In C# binaries, some strings are found more than once. list(REMOVE_DUPLICATES CMAKE_${lang}_COMPILER_ID_STRINGS) -- cgit v0.12