diff options
| author | ruki <waruqi@gmail.com> | 2018-08-11 00:46:01 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-08-10 22:36:08 +0800 |
| commit | 96e0ba81e20fa68d973ac84c01ead139118c072a (patch) | |
| tree | 5477b05cca91dc1170603fbe2f70749a2681e392 | |
| parent | 985a057cfd771c45d49727b15507f1a6ffbb451f (diff) | |
| download | xmake-docs-96e0ba81e20fa68d973ac84c01ead139118c072a.tar.gz xmake-docs-96e0ba81e20fa68d973ac84c01ead139118c072a.zip | |
modify title orders
| -rw-r--r-- | manual.md | 72 | ||||
| -rw-r--r-- | zh/manual.md | 76 |
2 files changed, 74 insertions, 74 deletions
@@ -240,6 +240,42 @@ if is_option("demo") then end ``` +##### is_config + +###### Is the given config values? + +This interface is introduced from version 2.2.2 to determine whether the specified configuration is a given value. + +For example: + +```console +$ xmake f --test=hello1 +``` + +```lua +option("test") + set_showmenu("true") + set_description("The test config option") +option_end() + +if is_config("test", "hello1", "hello2") then + add_defines("HELLO") +end +``` + +Not only that, we can also set pattern matching rules to determine values, such as: + +```lua +if is_config("test", "hello.*") then + add_defines("HELLO") +end +``` + +<p class="tips"> +This interface is not only able to determine the custom options defined through the [option](#option), +but also to determine the built-in global and local configuration. +</p> + ##### has_config ###### Is the given configs enabled? @@ -278,42 +314,6 @@ This interface can determine not only the built-in global and local configs, but also the custom options defined through the [option](#option). </p> -##### is_config - -###### Is the given config values? - -This interface is introduced from version 2.2.2 to determine whether the specified configuration is a given value. - -For example: - -```console -$ xmake f --test=hello1 -``` - -```lua -option("test") - set_showmenu("true") - set_description("The test config option") -option_end() - -if is_config("test", "hello1", "hello2") then - add_defines("HELLO") -end -``` - -Not only that, we can also set pattern matching rules to determine values, such as: - -```lua -if is_config("test", "hello.*") then - add_defines("HELLO") -end -``` - -<p class="tips"> -This interface is not only able to determine the custom options defined through the [option](#option), -but also to determine the built-in global and local configuration. -</p> - #### Global Interfaces The global interface affects the whole project description scope and all sub-project files. diff --git a/zh/manual.md b/zh/manual.md index ba5ab285..3236b4f3 100644 --- a/zh/manual.md +++ b/zh/manual.md @@ -258,44 +258,6 @@ if is_option("demo") then end ``` -##### has_config - -###### 判断配置是否启用或者存在 - -此接口从2.2.2版本开始引入,用于检测自定义或者内置的编译配置是否存在或启用。 - -例如以下配置情况,都会返回true: - -```console -# 启用某个配置选项(如果是boolean类型配置) -$ xmake f --test1=y -$ xmake f --test1=yes -$ xmake f --test1=true - -# 设置某个配置选项的值 -$ xmake f --test2=value -``` - -```lua --- 如果test1或者test2被设置或者启用 -if has_config("test1", "test2") then - add_defines("TEST") -end -``` - -而下面的情况则会禁用配置,返回false: - -```console -# 禁用配置(如果是boolean类型配置) -$ xmake f --test1=n -$ xmake f --test1=no -$ xmake f --test1=false -``` - -<p class="tips"> -此接口不仅能够判断内置的全局配置、本地配置,同时还可以判断通过[option](#option)定义的自定义配置选项。 -</p> - ##### is_config ###### 判断指定配置是否为给定的值 @@ -334,6 +296,44 @@ end 此接口不仅能够判断通过[option](#option)定义的自定义配置选项,同时还能判断内置的全局配置、本地配置。 </p> +##### has_config + +###### 判断配置是否启用或者存在 + +此接口从2.2.2版本开始引入,用于检测自定义或者内置的编译配置是否存在或启用。 + +例如以下配置情况,都会返回true: + +```console +# 启用某个配置选项(如果是boolean类型配置) +$ xmake f --test1=y +$ xmake f --test1=yes +$ xmake f --test1=true + +# 设置某个配置选项的值 +$ xmake f --test2=value +``` + +```lua +-- 如果test1或者test2被设置或者启用 +if has_config("test1", "test2") then + add_defines("TEST") +end +``` + +而下面的情况则会禁用配置,返回false: + +```console +# 禁用配置(如果是boolean类型配置) +$ xmake f --test1=n +$ xmake f --test1=no +$ xmake f --test1=false +``` + +<p class="tips"> +此接口不仅能够判断内置的全局配置、本地配置,同时还可以判断通过[option](#option)定义的自定义配置选项。 +</p> + #### 全局接口 全局接口影响整个工程描述,被调用后,后面被包含进来的所有子`xmake.lua`都会受影响。 |
