configuration_option.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>xmake</title>
  6. <link rel="icon" href="/assets/img/favicon.ico">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  8. <meta name="description" content="Description">
  9. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  10. <link href="/assets/npm/github-markdown/github-markdown.min.css" rel="stylesheet">
  11. <style>
  12. .markdown-body {
  13. box-sizing: border-box;
  14. min-width: 200px;
  15. max-width: 980px;
  16. margin: 0 auto;
  17. padding: 45px;
  18. }
  19. @media (max-width: 767px) {
  20. .markdown-body {
  21. padding: 15px;
  22. }
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <article class="markdown-body">
  28. <h4>This is a mirror page, please see the original page: </h4><a href="https://xmake.io/#/manual/configuration_option">https://xmake.io/#/manual/configuration_option</a>
  29. <div id="wwads-panel" class="wwads-cn wwads-vertical wwads-sticky" data-id="239" style="max-width:180px;bottom:20px;right:20px;width:200px;height:260px;background:#fff;position:fixed"></div>
  30. </br>
  31. <script type="text/javascript" charset="UTF-8" src="https://cdn.wwads.cn/js/makemoney.js" async></script>
  32. <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CE7I52QU&placement=xmakeio" id="_carbonads_js"></script>
  33. <style>
  34. #carbonads {
  35. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
  36. Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
  37. }
  38. #carbonads {
  39. display: flex;
  40. max-width: 330px;
  41. background-color: hsl(0, 0%, 98%);
  42. box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, .1);
  43. }
  44. #carbonads a {
  45. color: inherit;
  46. text-decoration: none;
  47. }
  48. #carbonads a:hover {
  49. color: inherit;
  50. }
  51. #carbonads span {
  52. position: relative;
  53. display: block;
  54. overflow: hidden;
  55. }
  56. #carbonads .carbon-wrap {
  57. display: flex;
  58. }
  59. .carbon-img {
  60. display: block;
  61. margin: 0;
  62. line-height: 1;
  63. }
  64. .carbon-img img {
  65. display: block;
  66. }
  67. .carbon-text {
  68. font-size: 13px;
  69. padding: 10px;
  70. line-height: 1.5;
  71. text-align: left;
  72. }
  73. .carbon-poweredby {
  74. display: block;
  75. padding: 8px 10px;
  76. background: repeating-linear-gradient(-45deg, transparent, transparent 5px, hsla(0, 0%, 0%, .025) 5px, hsla(0, 0%, 0%, .025) 10px) hsla(203, 11%, 95%, .4);
  77. text-align: center;
  78. text-transform: uppercase;
  79. letter-spacing: .5px;
  80. font-weight: 600;
  81. font-size: 9px;
  82. line-height: 1;
  83. }
  84. </style>
  85. <p>Define and set option switches. Each <code>option</code> corresponds to an option that can be used to customize the build configuration options and switch settings.</p>
  86. <p>!> All domain interfaces except <code>target</code>, such as <code>option</code>, <code>task</code>, etc., cannot be placed in the outer global scope by default (unless some interfaces are shared with the target).<br>If you want to set the value to affect all options such as <code>option</code>, <code>task</code>, you can set it by anonymous global domain.</p>
  87. <p>E.g:</p>
  88. <pre><code class="lang-lua">-- Enter the anonymous global domain of the option, the settings inside will affect the test and test2 options.
  89. option()
  90. add_defines("DEBUG")
  91. option("test")
  92. -- ...
  93. -- Try to keep indented, because all settings after this are for the test option.
  94. option("test2")
  95. -- ...
  96. </code></pre>
  97. <p>!> The <code>option</code> field can be repeatedly entered to implement separate settings. If you want to display the scope settings away from the current option, you can manually call the <a href="#option_end">option_end</a> interface.</p>
  98. <h3 id="option">option</h3>
  99. <h4 id="definingoptions">Defining options</h4>
  100. <p>Define and set option switches for custom compilation configuration options, switch settings.</p>
  101. <p>For example, define an option to enable test:</p>
  102. <pre><code class="lang-lua">option("test")
  103. set_default(false)
  104. set_showmenu(true)
  105. add_defines("TEST")
  106. </code></pre>
  107. <p>Then associate it with the specified target:</p>
  108. <pre><code class="lang-lua">target("demo")
  109. add_options("test")
  110. </code></pre>
  111. <p>Thus, if an option is defined, if this option is enabled, the macro definition of <code>-DTEST</code> will be automatically added when compiling the target.</p>
  112. <pre><code class="lang-lua"># Manually enable this option
  113. $ xmake f --test=y
  114. $ xmake
  115. </code></pre>
  116. <h3 id="option_end">option_end</h3>
  117. <h4 id="enddefinitionoption">End definition option</h4>
  118. <p>This is an optional api that shows the departure option scope, similar to <a href="/mirror/manual/project_target.html#target_end">target_end</a>.</p>
  119. <h3 id="optionadd_deps">option:add_deps</h3>
  120. <h4 id="addingoptionsdepends">Adding options depends</h4>
  121. <p>By setting the dependency, you can adjust the detection order of the options, which is generally used when the detection script is called by <a href="#optionon_check">on_check</a>.</p>
  122. <pre><code class="lang-lua">option("small")
  123. set_default(true)
  124. on_check(function (option)
  125. -- ...
  126. end)
  127. option("test")
  128. add_deps("small")
  129. set_default(true)
  130. after_check(function (option)
  131. if option:dep("small"):enabled() then
  132. option:enable(false)
  133. end
  134. end)
  135. </code></pre>
  136. <p>After the detection of the dependent small option is completed, the state of the option of the test is controlled by judging the state of the small option.</p>
  137. <p>!> Since on_check will only be executed when the default value is not set, if the default value is set, the custom logic can be processed in the after_check phase.</p>
  138. <h3 id="optionbefore_check">option:before_check</h3>
  139. <p>Execute this script before option detection</p>
  140. <pre><code class="lang-lua">option("zlib")
  141. before_check(function (option)
  142. end)
  143. </code></pre>
  144. <h3 id="optionon_check">option:on_check</h3>
  145. <h4 id="customoptiondetectionscript">Custom Option Detection Script</h4>
  146. <p>This script overrides the built-in option detection logic.</p>
  147. <pre><code class="lang-lua">option("test")
  148. add_deps("small")
  149. on_check(function (option)
  150. if option:dep("small"):enabled() then
  151. option:enable(false)
  152. end
  153. end)
  154. </code></pre>
  155. <p>If the option that test depends on passes, disable the test option.</p>
  156. <p>!> Only when <code>set_default</code> is not set, will the <code>on_check</code> be executed for custom option check script.</p>
  157. <h3 id="optionafter_check">option:after_check</h3>
  158. <p>Execute this script after option detection</p>
  159. <p>After the option detection is complete, execute this script for some post-processing, or you can re-disable the option at this time:</p>
  160. <pre><code class="lang-lua">option("test")
  161. add_deps("small")
  162. add_links("pthread")
  163. after_check(function (option)
  164. option:enable(false)
  165. end)
  166. </code></pre>
  167. <h3 id="optionset_values">option:set_values</h3>
  168. <h4 id="settingthelistofoptionvalues">Setting the list of option values</h4>
  169. <p>For the graphical menu configuration of <code>xmake f --menu</code> only, a list of option values is provided for quick selection by the user, for example:</p>
  170. <pre><code class="lang-lua">option("test")
  171. set_default("b")
  172. set_showmenu(true)
  173. set_values("a", "b", "c")
  174. </code></pre>
  175. <p>The effect chart is as follows:</p>
  176. <p><img src="/assets/img/manual/option_set_values.png" width="60%" /></p>
  177. <h3 id="optionset_default">option:set_default</h3>
  178. <h4 id="settingoptionsdefaults">Setting options defaults</h4>
  179. <p>When the option value is not modified by the command <code>xmake f --option=[y|n}</code>, the option itself has a default value, which can be set through this interface:</p>
  180. <pre><code class="lang-lua">option("test")
  181. -- This option is disabled by default
  182. set_default(false)
  183. </code></pre>
  184. <p>The value of the option supports not only the boolean type but also the string type, for example:</p>
  185. <pre><code class="lang-lua">option("test")
  186. set_default("value")
  187. </code></pre>
  188. <table>
  189. <thead>
  190. <tr>
  191. <th>Value Type</th>
  192. <th>Description</th>
  193. <th>Configuration</th>
  194. </tr>
  195. </thead>
  196. <tbody>
  197. <tr>
  198. <td>boolean</td>
  199. <td>Typically used as a parameter switch, value range: <code>true/false</code></td>
  200. <td><code>xmake f --optionname=[y/n/yes/no/true/false]</code></td>
  201. </tr>
  202. <tr>
  203. <td>string</td>
  204. <td>can be any string, generally used for pattern judgment</td>
  205. <td><code>xmake f --optionname=value</code></td>
  206. </tr>
  207. </tbody>
  208. </table>
  209. <p>If it is an option of the <code>boolean</code> value, it can be judged by <a href="/mirror/manual/conditions.html#has_config">has_config</a>, and the option is enabled.</p>
  210. <p>If it is an option of type <code>string</code>, it can be used directly in built-in variables, for example:</p>
  211. <pre><code class="lang-lua">-- define a path configuration option, using the temporary directory by default
  212. option("rootdir")
  213. set_default("$(tmpdir)")
  214. set_showmenu(true)
  215. target("test")
  216. -- add source files in the specified options directory
  217. add_files("$(rootdir)/*.c")
  218. </code></pre>
  219. <p>Among them, <code>$(rootdir)</code> is a custom option built-in variable, which can be dynamically modified by manual configuration:</p>
  220. <pre><code class="lang-bash">$ xmake f --rootdir=~/projectdir/src
  221. $ xmake
  222. </code></pre>
  223. <p>Specify a different source directory path for this <code>rootdir</code> option and compile it.</p>
  224. <p>Detection behavior of the option:</p>
  225. <table>
  226. <thead>
  227. <tr>
  228. <th>default value</th>
  229. <th>detection behavior</th>
  230. </tr>
  231. </thead>
  232. <tbody>
  233. <tr>
  234. <td>No setting</td>
  235. <td>Priority manual configuration modification, disabled by default, otherwise automatic detection, can automatically switch boolean and string type according to the type of value manually passed in</td>
  236. </tr>
  237. <tr>
  238. <td>false</td>
  239. <td>switch option, not automatic detection, disabled by default, can be manually configured to modify</td>
  240. </tr>
  241. <tr>
  242. <td>true</td>
  243. <td>switch option, not automatic detection, enabled by default, can be manually configured to modify</td>
  244. </tr>
  245. <tr>
  246. <td>string type</td>
  247. <td>no switch state, no automatic detection, can be manually configured and modified, generally used for configuration variable transfer</td>
  248. </tr>
  249. </tbody>
  250. </table>
  251. <h3 id="optionset_showmenu">option:set_showmenu</h3>
  252. <h4 id="setwhethertoenablemenudisplay">Set whether to enable menu display</h4>
  253. <p>If set to <code>true</code>, then this option will appear in <code>xmake f --help</code>, which can also be configured via <code>xmake f --optionname=xxx</code>, otherwise it can only be used inside <code>xmake.lua</code> , the modification cannot be configured manually.</p>
  254. <pre><code class="lang-lua">option("test")
  255. set_showmenu(true)
  256. </code></pre>
  257. <p>After setting the menu to enable, execute <code>xmake f --help</code> to see that there is one more item in the help menu:</p>
  258. <pre><code>Options:
  259. ...
  260. --test=TEST
  261. </code></pre><p>!> After 2.6.8, this option is enabled by default and there is usually no need to configure it additionally.</p>
  262. <h3 id="optionset_category">option:set_category</h3>
  263. <h4 id="settingoptioncategoriesonlyformenudisplay">Setting option categories, only for menu display</h4>
  264. <p>This is an optional configuration, only used in the help menu, the classification display options, the same category of options, will be displayed in the same group, so the menu looks more beautiful.</p>
  265. <p>E.g:</p>
  266. <pre><code class="lang-lua">option("test1")
  267. set_showmenu(true)
  268. set_category("test")
  269. option("test2")
  270. set_showmenu(true)
  271. set_category("test")
  272. option("demo1")
  273. set_showmenu(true)
  274. set_category("demo")
  275. option("demo2")
  276. set_showmenu(true)
  277. set_category("demo")
  278. </code></pre>
  279. <p>The four options here are grouped into two groups: <code>test</code> and <code>demo</code>, and the layout shown is similar to this:</p>
  280. <pre><code class="lang-bash">Options:
  281. ...
  282. --test1=TEST1
  283. --test2=TEST2
  284. --demo1=DEMO1
  285. --demo2=DEMO2
  286. </code></pre>
  287. <p>This interface is just to adjust the display layout, more beautiful, no other use.</p>
  288. <p>In version 2.1.9, the hierarchical path name <code>set_category("root/submenu/submenu2")</code> can be set via category to configure the graphical menu interface of <code>xmake f --menu</code>, for example:</p>
  289. <pre><code class="lang-lua">-- &#39;boolean&#39; option
  290. option("test1")
  291. set_default(true)
  292. set_showmenu(true)
  293. set_category("root menu/test1")
  294. -- &#39;choice&#39; option with values: "a", "b", "c"
  295. option("test2")
  296. set_default("a")
  297. set_values("a", "b", "c")
  298. set_showmenu(true)
  299. set_category("root menu/test2")
  300. -- &#39;string&#39; option
  301. option("test3")
  302. set_default("xx")
  303. set_showmenu(true)
  304. set_category("root menu/test3/test3")
  305. -- &#39;number&#39; option
  306. option("test4")
  307. set_default(6)
  308. set_showmenu(true)
  309. set_category("root menu/test4")
  310. </code></pre>
  311. <p>The menu interface path structure finally displayed in the above configuration:</p>
  312. <ul>
  313. <li>root menu<ul>
  314. <li>test1</li>
  315. <li>test2</li>
  316. <li>test3<ul>
  317. <li>test3</li>
  318. </ul>
  319. </li>
  320. <li>test4</li>
  321. </ul>
  322. </li>
  323. </ul>
  324. <p>The effect chart is as follows:</p>
  325. <p><img src="/assets/img/manual/option_set_category.gif" width="60%" /></p>
  326. <h3 id="optionset_description">option:set_description</h3>
  327. <h4 id="settingmenudisplaydescription">Setting menu display description</h4>
  328. <p>When the option menu is displayed, the description on the right is used to help the user know more clearly about the purpose of this option, for example:</p>
  329. <pre><code class="lang-lua">option("test")
  330. set_default(false)
  331. set_showmenu(true)
  332. set_description("Enable or disable test")
  333. </code></pre>
  334. <p>The generated menu contents are as follows:</p>
  335. <pre><code>Options:
  336. ...
  337. --test=TEST Enable or disable test (default: false)
  338. </code></pre><p>This interface also supports multi-line display and outputs more detailed description information, such as:</p>
  339. <pre><code class="lang-lua">option("mode")
  340. set_default("debug")
  341. set_showmenu(true)
  342. set_description("Set build mode",
  343. " - debug",
  344. " - release",
  345. "-profile")
  346. </code></pre>
  347. <p>The generated menu contents are as follows:</p>
  348. <pre><code>Options:
  349. ...
  350. --mode=MODE Set build mode (default: debug)
  351. - debug
  352. - release
  353. - profile
  354. </code></pre><p>When you see this menu, the user can clearly know the specific use of the defined <code>mode</code> option and how to use it:</p>
  355. <pre><code class="lang-bash">$ xmake f --mode=release
  356. </code></pre>
  357. <h3 id="optionadd_links">option:add_links</h3>
  358. <h4 id="addlinklibrarydetection">Add Link Library Detection</h4>
  359. <p>If the specified link library is passed, this option will be enabled and the associated target will automatically be added to this link, for example:</p>
  360. <pre><code class="lang-lua">option("pthread")
  361. add_links("pthread")
  362. add_linkdirs("/usr/local/lib")
  363. target("test")
  364. add_options("pthread")
  365. </code></pre>
  366. <p>If the test passes, the <code>test</code> target will be automatically added when it is compiled: <code>-L/usr/local/lib -lpthread</code> compile option</p>
  367. <h3 id="optionadd_linkdirs">option:add_linkdirs</h3>
  368. <h4 id="addingthesearchdirectoryneededforlinklibrarydetection">Adding the search directory needed for link library detection</h4>
  369. <p>This is optional. Generally, the system library does not need to add this, and it can also pass the test. If it is not found, you can add the search directory yourself to improve the detection pass rate. For details, see: <a href="#optionadd_links">add_links</a></p>
  370. <h3 id="optionadd_rpathdirs">option:add_rpathdirs</h3>
  371. <h4 id="addingaloadsearchdirectoryforadynamiclibraryatruntime">Adding a load search directory for a dynamic library at runtime</h4>
  372. <p>After the option passes the detection, it will be automatically added to the corresponding target. For details, see: <a href="/mirror/manual/project_target.html#targetadd_rpathdirs">target.add_rpathdirs</a>.</p>
  373. <h3 id="optionadd_cincludes">option:add_cincludes</h3>
  374. <h4 id="addcheaderfiledetection">Add c header file detection</h4>
  375. <p>This option will be enabled if the c header file is passed, for example:</p>
  376. <pre><code class="lang-lua">option("pthread")
  377. add_cincludes("pthread.h")
  378. add_defines("ENABLE_PTHREAD")
  379. target("test")
  380. add_options("pthread")
  381. </code></pre>
  382. <p>This option checks if there is a <code>pthread.h</code> header file. If the test passes, then the <code>test</code> target program will add the macro definition of <code>ENABLE_PTHREAD</code>.</p>
  383. <p>If you want more flexible detection, you can do this in <a href="#optionon_check">option.on_check</a> via <a href="#detect-has_cincludes">lib.detect.has_cincludes</a>.</p>
  384. <h3 id="optionadd_cxxincludes">option:add_cxxincludes</h3>
  385. <h4 id="addcheaderfiledetection">Add c++ header file detection</h4>
  386. <p>Similar to <a href="#optionadd_cincludes">add_cincludes</a>, except that the detected header file type is a c++ header file.</p>
  387. <h3 id="optionadd_ctypes">option:add_ctypes</h3>
  388. <h4 id="addctypedetection">Add c type detection</h4>
  389. <p>This option will be enabled if the c type is passed, for example:</p>
  390. <pre><code class="lang-lua">option("wchar")
  391. add_ctypes("wchar_t")
  392. add_defines("HAVE_WCHAR")
  393. target("test")
  394. add_options("wchar")
  395. </code></pre>
  396. <p>This option checks if there is a type of <code>wchar_t</code>. If the test passes, then the <code>test</code> target program will add the macro definition of <code>HAVE_WCHAR</code>.</p>
  397. <p>If you want more flexible detection, you can do this in <a href="#optionon_check">option.on_check</a> via <a href="#detect-has_ctypes">lib.detect.has_ctypes</a>.</p>
  398. <h3 id="optionadd_cxxtypes">option:add_cxxtypes</h3>
  399. <h4 id="addingctypedetection">Adding c++ type detection</h4>
  400. <p>Similar to <a href="#optionadd_ctypes">add_ctypes</a>, except that the type detected is a c++ type.</p>
  401. <h3 id="optionadd_csnippets">option:add_csnippets</h3>
  402. <h4 id="addccodefragmentdetection">Add c code fragment detection</h4>
  403. <p>If the existing <a href="#optionadd_ctypes">add_ctypes</a>, <a href="#optionadd_cfuncs">add_cfuncs</a>, etc. cannot meet the current detection requirements,<br>You can use this interface to implement more custom detection of some compiler feature detection, see: <a href="#optionadd_cxxsnippets">add_cxxsnippets</a>.</p>
  404. <h3 id="optionadd_cxxsnippets">option:add_cxxsnippets</h3>
  405. <h4 id="addingccodesnippetdetection">Adding c++ code snippet detection</h4>
  406. <p>This interface can be used to implement more custom detection of some compiler feature detection, especially the detection support of various features of C++, such as:</p>
  407. <pre><code class="lang-lua">option("constexpr")
  408. add_cxxsnippets("constexpr", "constexpr int f(int x) { int sum=0; for (int i=0; i<=x; ++i) sum += i; return sum; } constexpr int x = f (5); static_assert(x == 15);")
  409. </code></pre>
  410. <p>The first parameter sets the name of the code snippet as a label, and is displayed when the output information is detected.</p>
  411. <p>The above code implements the detection of the constexpr feature of C++. If the test passes, the constexpr option is enabled. Of course, this is just an example.</p>
  412. <p>For the detection of compiler features, there is a more convenient and efficient detection module, providing more powerful detection support, see: <a href="#compiler-has_features">compiler.has_features</a> and <a href="#detect-check_cxsnippets">detect.check_cxsnippets</a></p>
  413. <p>If you want more flexible detection, you can do this in <a href="#optionon_check">option.on_check</a> via <a href="#detect-check_cxsnippets">lib.detect.check_cxsnippets</a>.</p>
  414. <p>After v2.5.7, two new options, <code>{tryrun = true}</code> and <code>{output = true}</code>, are added to try to run detection and capture output.</p>
  415. <p>Setting tryrun can try to run to detect:</p>
  416. <pre><code class="lang-lua">option("test")
  417. add_cxxsnippets("HAS_INT_4", "return (sizeof(int) == 4)? 0: -1;", {tryrun = true})
  418. </code></pre>
  419. <p>Setting output will also try to detect and additionally capture the output content of the run.</p>
  420. <pre><code class="lang-lua">option("test")
  421. add_cxxsnippets("INT_SIZE",&#39;printf("%d", sizeof(int)); return 0;&#39;, {output = true, number = true})
  422. </code></pre>
  423. <p>!> Set to capture output, the current option cannot set other snippets</p>
  424. <p>We can also get the output bound to the option through <code>is_config</code>.</p>
  425. <pre><code class="lang-lua">if is_config("test", "8") then
  426. - xxx
  427. end
  428. </code></pre>
  429. <h3 id="optionadd_cfuncs">option:add_cfuncs</h3>
  430. <h4 id="addclibraryfunctiondetection">Add c library function detection</h4>
  431. <pre><code class="lang-lua">option("setjmp")
  432. add_cincludes("setjmp.h")
  433. add_cfuncs("sigsetjmp", "setjmp")
  434. add_defines("HAVE_SETJMP")
  435. target("test")
  436. add_options("setjmp")
  437. </code></pre>
  438. <p>This option detects whether there are some interfaces of <code>setjmp</code>. If the test passes, the target program of <code>test</code> will add the macro definition of <code>HAVE_SETJMP</code>.</p>
  439. <p>The function fragments inside support the following syntax formats:</p>
  440. <pre><code class="lang-lua">-- Simply detect whether the function address exists, and internally will try to determine its address
  441. sigsetjmp
  442. -- If some functions are defined by macro wrap, the detection can be bypassed in this way
  443. sigsetjmp((void*)0, 0)
  444. -- You can also specify a complete function statement, for example: funcname{codebody}
  445. sigsetjmp{sigsetjmp((void*)0, 0);}
  446. sigsetjmp{int a = 0; sigsetjmp((void*)a, a);}
  447. </code></pre>
  448. <p>Note that the detected function usually needs to be accompanied by <code>add_cincludes</code> to ensure that the function can be included normally, otherwise the detection will fail.</p>
  449. <h3 id="optionadd_cxxfuncs">option:add_cxxfuncs</h3>
  450. <h4 id="addclibraryfunctiondetection">Add c++ library function detection</h4>
  451. <p>The usage is consistent with <a href="#optionadd_cxxfuncs">option:add_cfuncs</a>.</p>
  452. </article>
  453. </body>
  454. </html>