我正在尝试使用介子配置项目。具体来说,我正在尝试设置一些选项。
meson config
告诉我,除其他外:
Core options:
Option Current Value Possible Values Description
------ ------------- --------------- -----------
buildtype debug [plain, debug, debugoptimized, release, minsize, custom] Build type to use
Base options:
Option Current Value Possible Values Description
------ ------------- --------------- -----------
b_lto false [true, false] Use link time optimization
(当然,其他选项已从此打印输出中删除。)
所以,我写:
meson build . --buildtype=release
在我的构建目录中,一切顺利 - 没有警告或错误(我仔细检查了选项值是否已更改)。然后我写:
meson build . --b_lto=true
但这让我很困惑:
meson: error: unrecognized arguments: --b_lto=true
我还尝试了
-b_lto=true
、--b_lto true
、b_lto=true
和b_lto true
。所有这些都没有 true
值。没有运气。
那么我该如何设置这些“基本选项”呢?
传递参数的
--option=value
和 --option value
样式仅适用于 介子手册中的 universial options 部分...所以不适用于 base options 等。而是使用 -Doption=value
语法来设置选项。这是建议的方式,因为
meson setup --help
声明
[-D option]
用于设置各种选项。请参阅介子团队的answer。所以,在你的情况下运行:
meson build . -Db_lto=true
或
meson configure build -Db_lto=true
如果自上次配置后构建目录发生更改,请使用 reconfigure
代替。
meson reconfigure build -Db_lto=true
或明确地:
meson setup --reconfigure -Db_lto=true build