Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
任何 c/cpp 文件都可以调用其他模块中定义的函数,只有链接阶段才能解决它们。这些 c/cpp 文件在编译序列中不相互依赖。
所以我的问题是,在任何情况下,一个 c/cpp 文件应该依赖于另一个文件,因此我们需要在 SConstruct 中指定如下:
hello=Program("hello.c") Depends(hello,'other_file')
谢谢!
强制 SCons 可能不知道的依赖关系可能很有用。例如,您可以使用
env.Command('a.xyz','b.abc','do_stuff.sh $SOURCES -o $TARGET')
它可能是一个简单的命令,但您知道它依赖于文件“templatefile.wxy”。
您可以使用 Scanner 编写一个完整的构建器(在这种情况下这可能是矫枉过正)。或者使用 Command + Depends。