Browse Source

update docs

ruki 2 years ago
parent
commit
7f232a7fd3

+ 41 - 0
manual/target_instance.md

@@ -249,6 +249,27 @@ target("test")
 
 The usage is similar to [target:has_ctypes](#targethas_ctypes), except that it is mainly used to detect the type of C++.
 
+#### target:has_cflags
+
+- Check whether the target compilation configuration can obtain the given C compilation flags
+
+```lua
+target("test")
+     set_kind("binary")
+     add_files("src/*.cpp")
+     on_config(function(target)
+         if target:has_cxxflags("-fPIC") then
+             target:add("defines", "HAS_PIC")
+         end
+     end)
+```
+
+#### target:has_cxxflags
+
+- Check whether the target compilation configuration can obtain the given C++ compilation flags
+
+The usage is similar to [target:has_cflags](#targethas_cflags), except that it is mainly used to detect the compilation flags of C++.
+
 #### target:has_cincludes
 
 - Check whether the target compilation configuration can obtain the given C header file
@@ -339,3 +360,23 @@ target("test")
          ]]}, {configs = {languages = "c++11"}, tryrun = true, output = true}))
      end)
 ```
+
+#### target:has_features
+
+- Detect if specified C/C++ compiler feature
+
+It is faster than using `check_cxxsnippets`, because it only performs preprocessing once to check all compiler features, instead of calling the compiler every time to try to compile.
+
+```
+target("test")
+     set_kind("binary")
+     add_files("src/*.cpp")
+     on_config(function(target)
+         if target:has_features("c_static_assert") then
+             target:add("defines", "HAS_STATIC_ASSERT")
+         end
+         if target:has_features("cxx_constexpr") then
+             target:add("defines", "HAS_CXX_CONSTEXPR")
+         end
+     end)
+```

+ 35 - 1
mirror/manual/target_instance.html

@@ -286,6 +286,24 @@ target("test")
 <li>Check whether the target compilation configuration can get the given C++ type</li>
 </ul>
 <p>The usage is similar to <a href="#targethas_ctypes">target:has_ctypes</a>, except that it is mainly used to detect the type of C++.</p>
+<h4 id="targethas_cflags">target:has_cflags</h4>
+<ul>
+<li>Check whether the target compilation configuration can obtain the given C compilation flags</li>
+</ul>
+<pre><code class="lang-lua">target("test")
+     set_kind("binary")
+     add_files("src/*.cpp")
+     on_config(function(target)
+         if target:has_cxxflags("-fPIC") then
+             target:add("defines", "HAS_PIC")
+         end
+     end)
+</code></pre>
+<h4 id="targethas_cxxflags">target:has_cxxflags</h4>
+<ul>
+<li>Check whether the target compilation configuration can obtain the given C++ compilation flags</li>
+</ul>
+<p>The usage is similar to <a href="#targethas_cflags">target:has_cflags</a>, except that it is mainly used to detect the compilation flags of C++.</p>
 <h4 id="targethas_cincludes">target:has_cincludes</h4>
 <ul>
 <li>Check whether the target compilation configuration can obtain the given C header file</li>
@@ -363,6 +381,22 @@ target("test")
          ]]}, {configs = {languages = "c++11"}, tryrun = true, output = true}))
      end)
 </code></pre>
-</article>
+<h4 id="targethas_features">target:has_features</h4>
+<ul>
+<li>Detect if specified C/C++ compiler feature</li>
+</ul>
+<p>It is faster than using <code>check_cxxsnippets</code>, because it only performs preprocessing once to check all compiler features, instead of calling the compiler every time to try to compile.</p>
+<pre><code>target("test")
+     set_kind("binary")
+     add_files("src/*.cpp")
+     on_config(function(target)
+         if target:has_features("c_static_assert") then
+             target:add("defines", "HAS_STATIC_ASSERT")
+         end
+         if target:has_features("cxx_constexpr") then
+             target:add("defines", "HAS_CXX_CONSTEXPR")
+         end
+     end)
+</code></pre></article>
 </body>
 </html>

+ 35 - 1
mirror/zh-cn/manual/target_instance.html

@@ -306,6 +306,24 @@ target("test")
 <li>检测目标编译配置能否获取给定的 C++ 类型</li>
 </ul>
 <p>用法跟 <a href="#targethas_ctypes">target:has_ctypes</a> 类似,只是这里主要用于检测 C++ 的类型。</p>
+<h4 id="targethas_cflags">target:has_cflags</h4>
+<ul>
+<li>检测目标编译配置能否获取给定的 C 编译 flags</li>
+</ul>
+<pre><code class="lang-lua">target("test")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    on_config(function (target)
+        if target:has_cxxflags("-fPIC") then
+            target:add("defines", "HAS_PIC")
+        end
+    end)
+</code></pre>
+<h4 id="targethas_cxxflags">target:has_cxxflags</h4>
+<ul>
+<li>检测目标编译配置能否获取给定的 C++ 编译 flags</li>
+</ul>
+<p>用法跟 <a href="#targethas_cflags">target:has_cflags</a> 类似,只是这里主要用于检测 C++ 的编译 flags。</p>
 <h4 id="targethas_cincludes">target:has_cincludes</h4>
 <ul>
 <li>检测目标编译配置能否获取给定的 C 头文件</li>
@@ -383,6 +401,22 @@ target("test")
         ]]}, {configs = {languages = "c++11"}, tryrun = true, output = true}))
     end)
 </code></pre>
-</article>
+<h4 id="targethas_features">target:has_features</h4>
+<ul>
+<li>检测是否指定的 C/C++ 编译特性</li>
+</ul>
+<p>它相比使用 <code>check_cxxsnippets</code> 来检测,会更加快一些,因为它仅仅执行一次预处理就能检测所有的编译器特性,而不是每次都去调用编译器尝试编译。</p>
+<pre><code>target("test")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    on_config(function (target)
+        if target:has_features("c_static_assert") then
+            target:add("defines", "HAS_STATIC_ASSERT")
+        end
+        if target:has_features("cxx_constexpr") then
+            target:add("defines", "HAS_CXX_CONSTEXPR")
+        end
+    end)
+</code></pre></article>
 </body>
 </html>

+ 102 - 102
sitemap.xml

@@ -12,512 +12,512 @@
 
 <url>
   <loc>https://xmake.io/mirror/guide/project_examples.html</loc>
-  <lastmod>2023-04-03T11:35:39+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/quickstart.html</loc>
-  <lastmod>2023-04-03T11:35:40+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/faq.html</loc>
-  <lastmod>2023-04-03T11:35:40+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/build_policies.html</loc>
-  <lastmod>2023-04-03T11:35:40+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/configuration.html</loc>
-  <lastmod>2023-04-03T11:35:40+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/syntax_description.html</loc>
-  <lastmod>2023-04-03T11:35:40+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/installation.html</loc>
-  <lastmod>2023-04-03T11:35:41+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/remote_build.html</loc>
-  <lastmod>2023-04-03T11:35:41+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/unity_build.html</loc>
-  <lastmod>2023-04-03T11:35:41+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/distcc_build.html</loc>
-  <lastmod>2023-04-03T11:35:41+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/trybuild.html</loc>
-  <lastmod>2023-04-03T11:35:41+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/autogen.html</loc>
-  <lastmod>2023-04-03T11:35:42+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/build_cache.html</loc>
-  <lastmod>2023-04-03T11:35:42+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/plugin_development.html</loc>
-  <lastmod>2023-04-03T11:35:42+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/more_plugins.html</loc>
-  <lastmod>2023-04-03T11:35:42+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/builtin_plugins.html</loc>
-  <lastmod>2023-04-03T11:35:42+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/awesome.html</loc>
-  <lastmod>2023-04-03T11:35:43+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/technical_support.html</loc>
-  <lastmod>2023-04-03T11:35:43+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/changelog.html</loc>
-  <lastmod>2023-04-03T11:35:43+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/contact.html</loc>
-  <lastmod>2023-04-03T11:35:43+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/introduction.html</loc>
-  <lastmod>2023-04-03T11:35:43+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/who_is_using_xmake.html</loc>
-  <lastmod>2023-04-03T11:35:43+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/sponsor.html</loc>
-  <lastmod>2023-04-03T11:35:44+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/index.html</loc>
-  <lastmod>2023-04-03T11:35:44+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/project_examples.html</loc>
-  <lastmod>2023-04-03T11:35:44+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/quickstart.html</loc>
-  <lastmod>2023-04-03T11:35:44+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/faq.html</loc>
-  <lastmod>2023-04-03T11:35:44+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/build_policies.html</loc>
-  <lastmod>2023-04-03T11:35:45+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/configuration.html</loc>
-  <lastmod>2023-04-03T11:35:45+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/syntax_description.html</loc>
-  <lastmod>2023-04-03T11:35:45+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/installation.html</loc>
-  <lastmod>2023-04-03T11:35:45+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/remote_build.html</loc>
-  <lastmod>2023-04-03T11:35:46+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/unity_build.html</loc>
-  <lastmod>2023-04-03T11:35:46+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/distcc_build.html</loc>
-  <lastmod>2023-04-03T11:35:46+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/trybuild.html</loc>
-  <lastmod>2023-04-03T11:35:46+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/autogen.html</loc>
-  <lastmod>2023-04-03T11:35:46+08:00</lastmod>
+  <lastmod>2023-04-04T17:08:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/build_cache.html</loc>
-  <lastmod>2023-04-03T11:35:46+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/plugin_development.html</loc>
-  <lastmod>2023-04-03T11:35:47+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/more_plugins.html</loc>
-  <lastmod>2023-04-03T11:35:47+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/builtin_plugins.html</loc>
-  <lastmod>2023-04-03T11:35:47+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/awesome.html</loc>
-  <lastmod>2023-04-03T11:35:47+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/technical_support.html</loc>
-  <lastmod>2023-04-03T11:35:47+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/changelog.html</loc>
-  <lastmod>2023-04-03T11:35:48+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/contact.html</loc>
-  <lastmod>2023-04-03T11:35:48+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/peripheral_items.html</loc>
-  <lastmod>2023-04-03T11:35:48+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/introduction.html</loc>
-  <lastmod>2023-04-03T11:35:48+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/who_is_using_xmake.html</loc>
-  <lastmod>2023-04-03T11:35:48+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/sponsor.html</loc>
-  <lastmod>2023-04-03T11:35:48+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/course.html</loc>
-  <lastmod>2023-04-03T11:35:49+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/index.html</loc>
-  <lastmod>2023-04-03T11:35:49+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/getting_started.html</loc>
-  <lastmod>2023-04-03T11:35:49+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/specification.html</loc>
-  <lastmod>2023-04-03T11:35:49+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_variables.html</loc>
-  <lastmod>2023-04-03T11:35:49+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/conditions.html</loc>
-  <lastmod>2023-04-03T11:35:50+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_rule.html</loc>
-  <lastmod>2023-04-03T11:35:50+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/target_instance.html</loc>
-  <lastmod>2023-04-03T11:35:50+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/project_target.html</loc>
-  <lastmod>2023-04-03T11:35:50+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_modules.html</loc>
-  <lastmod>2023-04-03T11:35:50+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_toolchain.html</loc>
-  <lastmod>2023-04-03T11:35:50+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/plugin_task.html</loc>
-  <lastmod>2023-04-03T11:35:51+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_dependencies.html</loc>
-  <lastmod>2023-04-03T11:35:51+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/configuration_option.html</loc>
-  <lastmod>2023-04-03T11:35:51+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/extension_modules.html</loc>
-  <lastmod>2023-04-03T11:35:51+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/helper_interfaces.html</loc>
-  <lastmod>2023-04-03T11:35:51+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/global_interfaces.html</loc>
-  <lastmod>2023-04-03T11:35:52+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_instance.html</loc>
-  <lastmod>2023-04-03T11:35:52+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/option_instance.html</loc>
-  <lastmod>2023-04-03T11:35:52+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/builtin_themes.html</loc>
-  <lastmod>2023-04-03T11:35:52+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/switch_theme.html</loc>
-  <lastmod>2023-04-03T11:35:52+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_3rd_source_library.html</loc>
-  <lastmod>2023-04-03T11:35:52+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package_old.html</loc>
-  <lastmod>2023-04-03T11:35:53+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package.html</loc>
-  <lastmod>2023-04-03T11:35:53+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/system_package.html</loc>
-  <lastmod>2023-04-03T11:35:53+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/remote_package.html</loc>
-  <lastmod>2023-04-03T11:35:53+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/remote_toolchain.html</loc>
-  <lastmod>2023-04-03T11:35:53+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2023-04-03T11:35:54+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/getting_started.html</loc>
-  <lastmod>2023-04-03T11:35:54+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/specification.html</loc>
-  <lastmod>2023-04-03T11:35:54+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_variables.html</loc>
-  <lastmod>2023-04-03T11:35:54+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/conditions.html</loc>
-  <lastmod>2023-04-03T11:35:54+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_rule.html</loc>
-  <lastmod>2023-04-03T11:35:55+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/target_instance.html</loc>
-  <lastmod>2023-04-03T11:35:55+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/project_target.html</loc>
-  <lastmod>2023-04-03T11:35:55+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_modules.html</loc>
-  <lastmod>2023-04-03T11:35:55+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_toolchain.html</loc>
-  <lastmod>2023-04-03T11:35:55+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/plugin_task.html</loc>
-  <lastmod>2023-04-03T11:35:56+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_dependencies.html</loc>
-  <lastmod>2023-04-03T11:35:56+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/configuration_option.html</loc>
-  <lastmod>2023-04-03T11:35:56+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/extension_modules.html</loc>
-  <lastmod>2023-04-03T11:35:56+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/helper_interfaces.html</loc>
-  <lastmod>2023-04-03T11:35:56+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/global_interfaces.html</loc>
-  <lastmod>2023-04-03T11:35:57+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_instance.html</loc>
-  <lastmod>2023-04-03T11:35:57+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/option_instance.html</loc>
-  <lastmod>2023-04-03T11:35:57+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/builtin_themes.html</loc>
-  <lastmod>2023-04-03T11:35:57+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:11+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/switch_theme.html</loc>
-  <lastmod>2023-04-03T11:35:57+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_3rd_source_library.html</loc>
-  <lastmod>2023-04-03T11:35:58+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package_old.html</loc>
-  <lastmod>2023-04-03T11:35:58+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package.html</loc>
-  <lastmod>2023-04-03T11:35:58+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/system_package.html</loc>
-  <lastmod>2023-04-03T11:35:58+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:12+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/remote_package.html</loc>
-  <lastmod>2023-04-03T11:35:58+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:13+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/remote_toolchain.html</loc>
-  <lastmod>2023-04-03T11:35:59+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:13+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2023-04-03T11:35:59+08:00</lastmod>
+  <lastmod>2023-04-04T17:09:13+08:00</lastmod>
 </url>
 
 </urlset>

+ 42 - 0
zh-cn/manual/target_instance.md

@@ -277,6 +277,28 @@ target("test")
 
 用法跟 [target:has_ctypes](#targethas_ctypes) 类似,只是这里主要用于检测 C++ 的类型。
 
+#### target:has_cflags
+
+- 检测目标编译配置能否获取给定的 C 编译 flags
+
+```lua
+target("test")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    on_config(function (target)
+        if target:has_cxxflags("-fPIC") then
+            target:add("defines", "HAS_PIC")
+        end
+    end)
+```
+
+#### target:has_cxxflags
+
+- 检测目标编译配置能否获取给定的 C++ 编译 flags
+
+用法跟 [target:has_cflags](#targethas_cflags) 类似,只是这里主要用于检测 C++ 的编译 flags。
+
+
 #### target:has_cincludes
 
 - 检测目标编译配置能否获取给定的 C 头文件
@@ -367,3 +389,23 @@ target("test")
         ]]}, {configs = {languages = "c++11"}, tryrun = true, output = true}))
     end)
 ```
+
+#### target:has_features
+
+- 检测是否指定的 C/C++ 编译特性
+
+它相比使用 `check_cxxsnippets` 来检测,会更加快一些,因为它仅仅执行一次预处理就能检测所有的编译器特性,而不是每次都去调用编译器尝试编译。
+
+```
+target("test")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    on_config(function (target)
+        if target:has_features("c_static_assert") then
+            target:add("defines", "HAS_STATIC_ASSERT")
+        end
+        if target:has_features("cxx_constexpr") then
+            target:add("defines", "HAS_CXX_CONSTEXPR")
+        end
+    end)
+```