summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCCompiler.cmake
diff options
context:
space:
mode:
authorDan McGregor <dan.mcgregor@usask.ca>2023-05-08 23:06:14 (GMT)
committerDan McGregor <dan.mcgregor@usask.ca>2023-05-09 00:09:27 (GMT)
commit6a82852dc219380d519138590181b6abd45bd4a1 (patch)
tree33f15e465e467597a9ae1fc5edc4f59392162414 /Modules/CMakeDetermineCCompiler.cmake
parentb2d689bc5abf027e6650cb8d68c9859249a0ea6f (diff)
downloadCMake-6a82852dc219380d519138590181b6abd45bd4a1.zip
CMake-6a82852dc219380d519138590181b6abd45bd4a1.tar.gz
CMake-6a82852dc219380d519138590181b6abd45bd4a1.tar.bz2
Allow toolchain suffix without leading dash
FreeBSD installs both LLVM and gcc with tools named after the major version, in the form "clang<major>", such as "clang16". Detect compilers named this way, and find the related toolchain tools.
Diffstat (limited to 'Modules/CMakeDetermineCCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index f5298df..8beebc5 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -162,7 +162,7 @@ if (NOT _CMAKE_TOOLCHAIN_PREFIX)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|QCC|LCC")
get_filename_component(COMPILER_BASENAME "${CMAKE_C_COMPILER}" NAME)
- if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
+ if (COMPILER_BASENAME MATCHES "^(.+-)?(clang|g?cc)(-cl)?(-?[0-9]+(\\.[0-9]+)*)?(-[^.]+)?(\\.exe)?$")
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
set(_CMAKE_TOOLCHAIN_SUFFIX ${CMAKE_MATCH_4})
set(_CMAKE_COMPILER_SUFFIX ${CMAKE_MATCH_6})