summaryrefslogtreecommitdiff
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authorChris Wright <chris.wright@mqa.co.uk>2022-03-24 09:52:39 +0000
committerChris Wright <chris.wright@mqa.co.uk>2022-04-04 16:56:47 +0100
commite9eabb0dcdb2fd8084135e02a1ad63047f8ae772 (patch)
tree89d5446f68cba13ab2eed308c21e6a493ddb95d7 /Modules/CMakeDetermineCompilerId.cmake
parent88b38f531adb90af752eb5af0f90eab0ee4343ae (diff)
downloadcmake-e9eabb0dcdb2fd8084135e02a1ad63047f8ae772.tar.gz
ADSP: Configure compiler in compiler module
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake11
1 files changed, 10 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 0317f34b33..a90fa5dbb7 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -841,15 +841,24 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(ARCHITECTURE_ID)
set(SIMULATE_ID)
set(SIMULATE_VERSION)
+ set(CMAKE_${lang}_COMPILER_ID_STRING_REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]")
foreach(encoding "" "ENCODING;UTF-16LE" "ENCODING;UTF-16BE")
file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS
LIMIT_COUNT 38 ${encoding}
- REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]")
+ REGEX "${CMAKE_${lang}_COMPILER_ID_STRING_REGEX}")
if(NOT CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "")
break()
endif()
endforeach()
+ # Some ADSP processors result in characters being detected as separate strings
+ if(CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "")
+ file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS LENGTH_MAXIMUM 1)
+ string(REGEX REPLACE ";" "" CMAKE_${lang}_COMPILER_ID_STRING "${CMAKE_${lang}_COMPILER_ID_STRINGS}")
+ string(REGEX MATCHALL "${CMAKE_${lang}_COMPILER_ID_STRING_REGEX}"
+ CMAKE_${lang}_COMPILER_ID_STRINGS "${CMAKE_${lang}_COMPILER_ID_STRING}")
+ endif()
+
# With the IAR Compiler, some strings are found twice, first time as incomplete
# list like "?<Constant "INFO:compiler[IAR]">". Remove the incomplete copies.
list(FILTER CMAKE_${lang}_COMPILER_ID_STRINGS EXCLUDE REGEX "\\?<Constant \\\"")