Index: mlir/cmake/modules/AddMLIRPython.cmake =================================================================== --- mlir/cmake/modules/AddMLIRPython.cmake +++ mlir/cmake/modules/AddMLIRPython.cmake @@ -607,15 +607,13 @@ # The extension itself must be compiled with RTTI and exceptions enabled. # Also, some warning classes triggered by pybind11 are disabled. - target_compile_options(${libname} PRIVATE - $<$,$,$>: - # Enable RTTI and exceptions. - -frtti -fexceptions - > - $<$: - # Enable RTTI and exceptions. - /EHsc /GR> - ) + set(eh_rtti_enable) + if (MSVC) + set(eh_rtti_enable /EHsc /GR) + elseif(LLVM_COMPILER_IS_GCC_COMPATIBLE) + set(eh_rtti_enable -frtti -fexceptions) + endif () + target_compile_options(${libname} PRIVATE ${eh_rtti_enable}) # Configure the output to match python expectations. set_target_properties(