获取烘焙文件中命令的输出
Getting the output of a command in a Bakefile
我刚刚开始使用wxWidgets进行项目,我正在尝试为跨平台编译设置一个Bakefile。我需要将wx-config --libs
和wx-config --cxxflags
的输出传递给编译器。
我怎样才能做到这一点?我在 Bakefile 文档中找不到有关将命令的输出放入变量的任何内容。反引号似乎不起作用:
myvar = `wx-config --libs`
#=> bakefile.bkl:2:12: error: no viable alternative at character u'`'
您需要在此处使用引号,即
myvar = "`wx-config --libs`"
作为参考,以下是我在自己的烘焙文件中所做的:
if ( $toolset == gnu || $toolset == gnu-osx ) {
setting WX_CONFIG {
default = wx-config;
help = "Path to the wx-config script";
}
compiler-options += "`$(WX_CONFIG) --cppflags`";
link-options += "`$(WX_CONFIG) --libs`";
}
这允许做一些事情,比如make WX_CONFIG=/full/path/to/wx-config
,这在使用未安装的wxWidgets版本时很方便。
相关文章:
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 如何在OMNET++中指定与命令行参数组合的输出文件名
- C++编译器命令 C++ 不会生成输出
- 使用提升过程获取 shell 命令的标准输出
- cmake add_custom_command + Xcode:多输出 = 多命令调用
- gdb 中的列表命令不输出我编写的代码
- Windows 10命令提示符的输出不正确
- 如何在C++中执行命令并获取命令的返回代码标准输出和标准
- 获取使用p4api运行的Perforce命令的输出
- 在结束运行之前获取 c++ 中的 shell 命令输出
- 将 Tcl 中的命令输出重定向到文件时,文件以 DOS 格式生成
- 终端命令输出到 CPP 中的数组
- Valgrind 在主机名命令输出中显示内存泄漏
- C++ 无限循环读取文件创建重定向命令输出
- 如何在windows中的gcc中逐行读取命令输出,就像使用标准输入一样
- 微软nmake:是否可以从shell命令输出中定义宏
- GNU Make -在规则/目标中设置shell命令输出中的MAKEFILE变量
- nm 命令输出中的"@@"符号是什么意思?
- 无法理解核心文件分析的 GDB x 命令输出
- 如何将系统命令输出存储在变量中