Skip to content

Commit 9aaf3b1

Browse files
authored
doc: fix documentation about how to enable C++ exception (#1059)
* doc: fixed doc about how to enable C++ exceptions. PR-URL: #1059 Reviewed-By: Michael Dawson <[email protected]>
1 parent b2f8619 commit 9aaf3b1

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

doc/setup.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,25 @@ To use **Node-API** in a native module:
3939
```gyp
4040
'cflags!': [ '-fno-exceptions' ],
4141
'cflags_cc!': [ '-fno-exceptions' ],
42-
'xcode_settings': {
43-
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
44-
'CLANG_CXX_LIBRARY': 'libc++',
45-
'MACOSX_DEPLOYMENT_TARGET': '10.7',
46-
},
47-
'msvs_settings': {
48-
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
49-
},
42+
'conditions': [
43+
["OS=='win'", {
44+
"defines": [
45+
"_HAS_EXCEPTIONS=1"
46+
],
47+
"msvs_settings": {
48+
"VCCLCompilerTool": {
49+
"ExceptionHandling": 1
50+
},
51+
},
52+
}],
53+
["OS=='mac'", {
54+
'xcode_settings': {
55+
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
56+
'CLANG_CXX_LIBRARY': 'libc++',
57+
'MACOSX_DEPLOYMENT_TARGET': '10.7',
58+
},
59+
}],
60+
],
5061
```
5162

5263
Alternatively, disable use of C++ exceptions in Node-API:

0 commit comments

Comments
 (0)