Apply -fno-objc-exceptions flag for ObjC sources only

This commit is contained in:
Ryan Burns 2020-12-03 18:43:10 -08:00
commit 7c8576085a

View file

@ -305,10 +305,8 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
# Set -fno-objc-exceptions, for consistency with -fno-exceptions earlier.
# If we set only -fno-exceptions, fmt fails to compile when included from
# Objective-C++ because fmt tries try to use throw because __EXCEPTIONS is defined.
#
# TODO: Only enable this for Objective-C(++).
# We get warnings if we enable this when building regular C(++) code.
check_and_add_flag(NO_OBJC_EXCEPTIONS -fno-objc-exceptions)
add_compile_options("$<$<COMPILE_LANGUAGE:OBJC>:-fno-objc-exceptions>")
add_compile_options("$<$<COMPILE_LANGUAGE:OBJCXX>:-fno-objc-exceptions>")
find_library(APPKIT_LIBRARY AppKit)
find_library(APPSERV_LIBRARY ApplicationServices)