summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-03 19:35:15 (GMT)
committerBrad King <brad.king@kitware.com>2020-12-03 19:37:21 (GMT)
commitf25ac39deeba879bb521f5c6f6ed3bc79ad5602c (patch)
treeb49ed8e015456d9fc0da6d813b581bb01c5364b8 /Modules/CMakeDetermineCompilerId.cmake
parent5cb66f17cadebd746d57cb95df67e9b3f327c4a1 (diff)
downloadCMake-f25ac39deeba879bb521f5c6f6ed3bc79ad5602c.zip
CMake-f25ac39deeba879bb521f5c6f6ed3bc79ad5602c.tar.gz
CMake-f25ac39deeba879bb521f5c6f6ed3bc79ad5602c.tar.bz2
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
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake4
1 files changed, 4 insertions, 0 deletions
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)