summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CheckCompilerFlag
diff options
context:
space:
mode:
authormakise-homura <akemi_homura@kurisa.ch>2021-10-05 19:41:02 (GMT)
committermakise-homura <akemi_homura@kurisa.ch>2021-10-15 02:05:19 (GMT)
commite5d9fce03feeece7f53451da9fb958db2613d31e (patch)
treea8e5fc2001514dce2f4f390f48f416f650db456e /Tests/RunCMake/CheckCompilerFlag
parent2b9ef77944cab3a330fa547dbe7e87aefd80b795 (diff)
downloadCMake-e5d9fce03feeece7f53451da9fb958db2613d31e.zip
CMake-e5d9fce03feeece7f53451da9fb958db2613d31e.tar.gz
CMake-e5d9fce03feeece7f53451da9fb958db2613d31e.tar.bz2
LCC: Add dedicated support for MCST LCC compiler
Divert LCC compiler as a new one, instead of treating it as GNU. Since old times, Elbrus C/C++/Fortran Compiler (LCC) by MCST has been passing checks for GNU compilers, so it has been identified as GNU. Now, with intent of seriously upstreaming its support, it has been added as a separate LCC compiler, and its version displays not a supported GCC version, but LCC version itself (e.g. LCC 1.25.19 instead of GNU 7.3.0). This commit adds its support for detection, and also converts basically every check like 'is this compiler GNU?' to 'is this compiler GNU or LCC?'. The only places where this check is untouched, is where it regards other platforms where LCC is unavailable (primarily non-Linux), and where it REALLY differs from GNU compiler. Note: this transition may break software that are already ported to Elbrus, but hardly relies that LCC will be detected as GNU; still such software is not known.
Diffstat (limited to 'Tests/RunCMake/CheckCompilerFlag')
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake4
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake2
-rw-r--r--Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake2
3 files changed, 4 insertions, 4 deletions
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
index 6483f11..79d67e5 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCCompilerFlag.cmake
@@ -9,14 +9,14 @@ if(SHOULD_FAIL)
message(SEND_ERROR "invalid C compile flag didn't fail.")
endif()
-if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+if(CMAKE_C_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
check_compiler_flag(C "-x c" SHOULD_WORK)
if(NOT SHOULD_WORK)
message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-x c' check failed")
endif()
endif()
-if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU") # LCC C compiler silently ignore -frtti instead of failing, so skip it here.
check_compiler_flag(C "-frtti" SHOULD_FAIL_RTTI)
if(SHOULD_FAIL_RTTI)
message(SEND_ERROR "${CMAKE_C_COMPILER_ID} compiler flag '-frtti' check passed but should have failed")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
index 60e9755..4b20ebd 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckCXXCompilerFlag.cmake
@@ -9,7 +9,7 @@ if(SHOULD_FAIL)
message(SEND_ERROR "invalid CXX compile flag didn't fail.")
endif()
-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|LCC|Clang" AND NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
check_compiler_flag(CXX "-x c++" SHOULD_WORK)
if(NOT SHOULD_WORK)
message(SEND_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed")
diff --git a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
index 7bb88b1..236f37b 100644
--- a/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
+++ b/Tests/RunCMake/CheckCompilerFlag/CheckFortranCompilerFlag.cmake
@@ -8,7 +8,7 @@ if(SHOULD_FAIL)
message(SEND_ERROR "invalid Fortran compile flag didn't fail.")
endif()
-if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU|LCC")
check_compiler_flag(Fortran "-Wall" SHOULD_WORK)
if(NOT SHOULD_WORK)
message(SEND_ERROR "${CMAKE_Fortran_COMPILER_ID} compiler flag '-Wall' check failed")