diff options
author | Chuck Atkins <chuck.atkins@kitware.com> | 2020-12-22 13:07:20 -0700 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-03-30 10:32:53 -0400 |
commit | 3c867cff4a98bb198211e3d9f8494fbb478a29e4 (patch) | |
tree | e8fb2a3671d292ff21430df67e95000f20a63bce /Modules/CMakeDetermineCompilerId.cmake | |
parent | d5ab6a53edef5f259f9b9446943dcc5113898b51 (diff) | |
download | cmake-3c867cff4a98bb198211e3d9f8494fbb478a29e4.tar.gz |
Fujitsu: Add support for the Fujitsu compiler in Trad mode
Co-Author: Yuichiro Utsumi <utsumi.yuichiro@jp.fujitsu.com>
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f406e5ae00..017c51a8bd 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -165,6 +165,25 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) endif() endif() + # The Fujitsu compiler does not always convey version information through + # preprocessor symbols so we extract through command line info + if (CMAKE_${lang}_COMPILER_ID STREQUAL "Fujitsu") + if(NOT CMAKE_${lang}_COMPILER_VERSION) + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" -V + OUTPUT_VARIABLE output + ERROR_VARIABLE output + RESULT_VARIABLE result + TIMEOUT 10 + ) + if (result EQUAL 0) + if (output MATCHES [[Fujitsu [^ ]* Compiler ([0-9]+\.[0-9]+\.[0-9]+)]]) + set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_MATCH_1}") + endif() + endif() + endif() + endif() + # if the format is unknown after all files have been checked, put "Unknown" in the cache if(NOT CMAKE_EXECUTABLE_FORMAT) set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") @@ -830,8 +849,10 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION "${COMPILER_VERSION}") endif() if("${info}" MATCHES "INFO:compiler_version_internal\\[([^]\"]*)\\]") - string(REGEX REPLACE "^0+([0-9])" "\\1" COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}") - string(REGEX REPLACE "\\.0+([0-9])" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}") + set(COMPILER_VERSION_INTERNAL "${CMAKE_MATCH_1}") + string(REGEX REPLACE "^0+([0-9]+)" "\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}") + string(REGEX REPLACE "\\.0+([0-9]+)" ".\\1" COMPILER_VERSION_INTERNAL "${COMPILER_VERSION_INTERNAL}") + string(STRIP "${COMPILER_VERSION_INTERNAL}" COMPILER_VERSION_INTERNAL) endif() foreach(comp MAJOR MINOR PATCH TWEAK) foreach(digit 1 2 3 4 5 6 7 8 9) |