Skip to content

Commit

Permalink
Force exception handling / unwind disposition under msvc
Browse files Browse the repository at this point in the history
msvc seems to default to exceptions off, and cmake does not
explicitly turn it on. Force it on as a public option so any
users of IlmBase will inherit that option. Otherwise, if an
exception occurs, mutex unlocks and such do not happen.

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Aug 27, 2019
1 parent 39c17b9 commit b4d5d86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion IlmBase/config/LibraryDefine.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ function(ILMBASE_DEFINE_LIBRARY libname)
else()
set(use_objlib)
endif()

if (MSVC)
set(_ilmbase_extra_flags "/EHsc")
endif()
if(use_objlib)
set(objlib ${libname}_Object)
add_library(${objlib} OBJECT
Expand Down Expand Up @@ -56,6 +58,9 @@ function(ILMBASE_DEFINE_LIBRARY libname)
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON
)
if (_ilmbase_extra_flags)
target_compile_options(${objlib} PUBLIC ${_ilmbase_extra_flags})
endif()
set_property(TARGET ${objlib} PROPERTY PUBLIC_HEADER ${ILMBASE_CURLIB_HEADERS})

if(use_objlib)
Expand Down

0 comments on commit b4d5d86

Please sign in to comment.