Hind Forsum
Hind Forsum

Reputation: 10527

scons: how to specify dependency to an external build target?

I'm using protobuf to generate from .proto files to .cc/.h files. So I have my SConscript as below:

env.protoc('my.proto')
env.Program(target='pb_my',    CCFLAGS="-I.",   
        source=['pb_my.cpp',    'my.pb.cc'],       LIBS='protobuf')

I find that, the "env." commands in a SConscript is not executed in sequence(that's why targets can be build in parallel using scons -j20). But sometimes problem is, because the target of "pb_my" should be build after I generate "my.pb.cc" from "my.proto", scons will report error is second line is executed first.

So how can I specify that the second line's target should only be executed after 1st line is finished?

Thanks a lot.

Upvotes: 1

Views: 392

Answers (1)

bdbaddog
bdbaddog

Reputation: 3509

You cannot specify order in scons directly.

The proper way is to make sure the dependencies are specified.

Please include the code for your protobuf builder?

Likely if files output from your protobuf builder are being compiled before they are generated your protobuf builder isn't specifying them.

Also, please add output of scons --tree=prune to your question.

Upvotes: 3

Related Questions