diff --git a/CMakeLists.txt b/CMakeLists.txt index 68fc79060..a71f378f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,9 +293,7 @@ if(${Backtrace_FOUND}) $<${ci_or_debug}:${Backtrace_INCLUDE_DIRS}>) endif() -if(MSVC) - target_compile_definitions(snmalloc INTERFACE -D_HAS_EXCEPTIONS=0) -else() +if(NOT MSVC) check_linker_flag(CXX "-rdynamic" SNMALLOC_LINKER_SUPPORT_RDYNAMIC) if (SNMALLOC_LINKER_SUPPORT_RDYNAMIC) # Get better stack traces in CI and debug builds. @@ -429,6 +427,10 @@ if(NOT SNMALLOC_HEADER_ONLY_LIBRARY) set_target_properties(${name} PROPERTIES CXX_VISIBILITY_PRESET hidden INTERPROCEDURAL_OPTIMIZATION ${SNMALLOC_COMPILER_SUPPORT_IPO}) target_compile_definitions(${name} PRIVATE "SNMALLOC_USE_${SNMALLOC_CLEANUP}") + if(MSVC) + target_compile_definitions(${name} INTERFACE -D_HAS_EXCEPTIONS=0) + endif() + add_warning_flags(${name}) if(NOT MSVC) target_compile_definitions(${name} PRIVATE "SNMALLOC_EXPORT=__attribute__((visibility(\"default\")))")