summaryrefslogtreecommitdiff
path: root/Modules/CMakeDetermineCompilerId.cmake
diff options
context:
space:
mode:
authormakise-homura <akemi_homura@kurisa.ch>2021-10-19 21:43:45 +0300
committermakise-homura <akemi_homura@kurisa.ch>2021-10-21 17:24:22 +0300
commit3958ed878f2365fd1af004341d45dac7f4e94afb (patch)
tree0192b68ccf8fc248efadb1bf91deddc1927bf434 /Modules/CMakeDetermineCompilerId.cmake
parent52ea22ca65d86627e9ab571f2a87d4a952a7d85e (diff)
downloadcmake-3958ed878f2365fd1af004341d45dac7f4e94afb.tar.gz
LCC: Add policy CMP0129 regarding interpreting LCC as GNU
Due to MCST LCC compiler identification is now changed to LCC, there should be a way for old projects to still identify it as GNU, as it was before. This commits adds the policy: CMP0129: Compiler id for MCST LCC compilers is now LCC, not GNU. This policy controls such a behavior. OLD behaivior is to treat LCC as GNU, NEW is to treat is as LCC.
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 6437be0cf2..ca90032113 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -150,6 +150,27 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif()
endif()
+ # For LCC Fortran we need to explicitly query the version.
+ if(lang STREQUAL "Fortran"
+ AND CMAKE_${lang}_COMPILER_ID STREQUAL "LCC")
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ --version
+ OUTPUT_VARIABLE output ERROR_VARIABLE output
+ RESULT_VARIABLE result
+ TIMEOUT 10
+ )
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Running the ${lang} compiler: \"${CMAKE_${lang}_COMPILER}\" --version\n"
+ "${output}\n"
+ )
+
+ if(output MATCHES [[\(GCC\) ([0-9]+\.[0-9]+(\.[0-9]+)?) compatible]])
+ set(CMAKE_${lang}_SIMULATE_ID "GNU")
+ set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+
if (COMPILER_QNXNTO AND (CMAKE_${lang}_COMPILER_ID STREQUAL "GNU" OR CMAKE_${lang}_COMPILER_ID STREQUAL "LCC"))
execute_process(
COMMAND "${CMAKE_${lang}_COMPILER}"