我正在尝试从SConscript
文件中检查是否存在库,如下所示:
# Not sure if this bit is relevant:
Import('env')
env = env.Clone()
# This is what I'm trying to do:
conf = env.Configure()
if conf.CheckLib('gcrypt'):
pass # actually something more interesting
......但它不起作用。我得到的是来自scons
的不透明错误,如下所示:
scons: ***
File "/home/src/foo/bar/SConscript", line 49, in <module>
...第49行是conf = env.Configure()
行。
这是在Mac OS X上,我不希望找到提到的库。如何在SConscript
文件中检测到这一点?
答案 0 :(得分:0)
我对此进行了测试,效果很好。也许它是你如何创建或传递env的问题。这是我的示例代码,以防它有用:
<强> SConstruct 强>
env = Environment()
env.SConscript('SConscript', exports='env', duplicate=0)
<强> SConscript 强>
Import('env')
env = env.Clone()
conf = env.Configure()
if conf.CheckLib('gcrypt'):
pass
结果如下:
$ scons
scons: Reading SConscript files ...
Checking for C library gcrypt... no
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.