介子构建系统允许使用选项--default-library
构建共享库或静态库。但是,我无法知道是否正在构建共享库或静态库,我需要至少传递一个定义。有没有办法查询库类型?
这是我的猜测:
libtype = get_option('default-library')
if libtype = 'shared'
build_dll = ['-DBUILDING_DLL', '-fvisibility=hidden']
else
build_dll = ''
endif
但显然我得到了:
Meson encountered an error in file meson.build, line 10, column 0:
Tried to access unknown option "default-library".
答案 0 :(得分:1)
如果其他人遇到此问题,解决方案很简单:
libtype = get_option('default_library')
(答案归功于jpakkane(介子的创造者),他在IRC上回答)