diff --git a/except.gypi b/except.gypi index 1f295d10a..e2fb2c5a4 100644 --- a/except.gypi +++ b/except.gypi @@ -2,15 +2,24 @@ 'defines': [ 'NAPI_CPP_EXCEPTIONS' ], 'cflags!': [ '-fno-exceptions' ], 'cflags_cc!': [ '-fno-exceptions' ], - 'msvs_settings': { - 'VCCLCompilerTool': { - 'ExceptionHandling': 1, - 'EnablePREfast': 'true', - }, - }, - 'xcode_settings': { - 'CLANG_CXX_LIBRARY': 'libc++', - 'MACOSX_DEPLOYMENT_TARGET': '10.7', - 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', - }, + 'conditions': [ + ["OS=='win'", { + "defines": [ + "_HAS_EXCEPTIONS=1" + ], + "msvs_settings": { + "VCCLCompilerTool": { + "ExceptionHandling": 1, + 'EnablePREfast': 'true', + }, + }, + }], + ["OS=='mac'", { + 'xcode_settings': { + 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', + 'CLANG_CXX_LIBRARY': 'libc++', + 'MACOSX_DEPLOYMENT_TARGET': '10.7', + }, + }], + ], } diff --git a/noexcept.gypi b/noexcept.gypi index 179f21f79..404a05f30 100644 --- a/noexcept.gypi +++ b/noexcept.gypi @@ -2,15 +2,25 @@ 'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ], 'cflags': [ '-fno-exceptions' ], 'cflags_cc': [ '-fno-exceptions' ], - 'msvs_settings': { - 'VCCLCompilerTool': { - 'ExceptionHandling': 0, - 'EnablePREfast': 'true', - }, - }, - 'xcode_settings': { - 'CLANG_CXX_LIBRARY': 'libc++', - 'MACOSX_DEPLOYMENT_TARGET': '10.7', - 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', - }, + 'conditions': [ + ["OS=='win'", { + # _HAS_EXCEPTIONS is already defined and set to 0 in common.gypi + #"defines": [ + # "_HAS_EXCEPTIONS=0" + #], + "msvs_settings": { + "VCCLCompilerTool": { + 'ExceptionHandling': 0, + 'EnablePREfast': 'true', + }, + }, + }], + ["OS=='mac'", { + 'xcode_settings': { + 'CLANG_CXX_LIBRARY': 'libc++', + 'MACOSX_DEPLOYMENT_TARGET': '10.7', + 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', + }, + }], + ], }