From 2dd4221451c0b28d6b25aaa6842263b7ed49d35a Mon Sep 17 00:00:00 2001 From: Hwi-sung Im Date: Tue, 21 Oct 2025 13:19:19 -0700 Subject: [PATCH] Fix configuration error for non-MSVC compilers. --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1a8bb9d4..6d66f8dc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -393,12 +393,18 @@ endif() ################################################################################ # Control Flow Guard (MSVC only) ################################################################################ -option(Z3_ENABLE_CFG "Enable Control Flow Guard security checks" ON) +# Default CFG to ON for MSVC, OFF for other compilers. +if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + option(Z3_ENABLE_CFG "Enable Control Flow Guard security checks" ON) +else() + option(Z3_ENABLE_CFG "Enable Control Flow Guard security checks" OFF) +endif() + if (Z3_ENABLE_CFG) if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") message(FATAL_ERROR "Z3_ENABLE_CFG is only supported with MSVC compiler. " "Current compiler: ${CMAKE_CXX_COMPILER_ID}. " - "You should set Z3_ENABLE_CFG to OFF or use MSVC to compile.") + "You should remove Z3_ENABLE_CFG or set it to OFF or use MSVC to compile.") endif() # Check for incompatible options (handle both / and - forms for robustness)