LLVMFlang: Add support for MSVC_RUNTIME_CHECKS abstraction on Windows

Extend commit 2b2344b412 (MSVC: Add abstraction for runtime checks,
2025-01-22, v4.0.0-rc1~92^2) to cover LLVMFlang.  This is necessary
to configure with CMP0184's NEW behavior.
This commit is contained in:
Brad King
2026-05-15 17:30:47 -04:00
parent 92ab54ae3b
commit 95abfcbe51
3 changed files with 13 additions and 1 deletions
@@ -5,6 +5,11 @@ elseif("x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC")
include(Platform/Windows-MSVC)
__windows_compiler_msvc(Fortran)
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_PossibleDataLoss "")
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_StackFrameErrorCheck "")
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_UninitializedVariable "")
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_CHECKS_RTCsu "")
if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0)
set(_LLVMFlang_LINK_RUNTIME "")
set(CMAKE_Fortran_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "-fms-runtime-lib=static")
@@ -4,6 +4,12 @@ if("${CMAKE_${lang}_COMPILER_ID};${CMAKE_${lang}_SIMULATE_ID};${CMAKE_${lang}_CO
set(empty_StackFrameErrorCheck 1)
set(empty_UninitializedVariable 1)
set(empty_RTCsu 1)
elseif("${CMAKE_${lang}_COMPILER_ID};${CMAKE_${lang}_SIMULATE_ID};${lang}" STREQUAL "LLVMFlang;MSVC;Fortran")
# LLVMFlang does not actually support these, so Windows-LLVMFlang-Fortran passes no flags.
set(empty_PossibleDataLoss 1)
set(empty_StackFrameErrorCheck 1)
set(empty_UninitializedVariable 1)
set(empty_RTCsu 1)
elseif("${CMAKE_${lang}_COMPILER_ID};${CMAKE_${lang}_SIMULATE_ID};${lang}" MATCHES "^Intel(LLVM)?;MSVC;Fortran$")
# IntelLLVM Fortran does not actually support these, so Windows-IntelLLVM-Fortran passes no flags.
set(empty_PossibleDataLoss 1)
+2 -1
View File
@@ -1,6 +1,7 @@
/* Some compilers ignore the -RTC flags even if specified. */
#if (defined(_MSC_VER) && _MSC_VER <= 1310) || defined(__clang__) || \
defined(__INTEL_LLVM_COMPILER) || defined(__INTEL_COMPILER)
defined(__flang__) || defined(__INTEL_LLVM_COMPILER) || \
defined(__INTEL_COMPILER)
# define NO__MSVC_RUNTIME_CHECKS
#endif