[Scons-users] Generating header from cpp file causes cycle
Bill Deegan
bill at baddogconsulting.com
Sun Mar 19 00:17:43 EDT 2017
Your header file builder includes the header being generated.
There is a dependency cycle..
Is that really the code you have? (or just an example which doesn't mimic
your actual build?)
-Bill
On Sat, Mar 18, 2017 at 10:00 PM, Ivan Nedrehagen via Scons-users <
scons-users at scons.org> wrote:
> I have a unit test library that generates headers from the cpp files that
> contains tests.
>
> Lately with my updated version of SCons (2.5.0) I get dependency cycles.
>
> (It is very hard to debug these cycles, because --tree doesn't output
> anything)
>
>
> A case that reproduce the problem:
>
> --- SConstruct ---
>
> def create_header(target, source, env):
> txt = " class Test {}; \n"
> file = open(str(target))
> file.write(txt)
>
> env = Environment()
>
> headerBuilder = env.Builder(action=create_header)
>
> env.Append(BUILDERS={"Header": headerBuilder})
>
> header = env.Header("test.h", "test.cpp")
> exe = env.Program("test.cpp")
>
> --- test.cpp ---
>
> #include "test.h"
>
> int main() {
> Test test;
> return 0;
> }
>
> --- Result ---
>
> scons: *** Found dependency cycle(s):
> test.h -> test.h
>
> --- End of Case ---
>
> Why is this failing? I understand that the test.o should be dependent on
> test.h, but why is suddenly test.h depending on itself?
>
> I tried to set target_scanner and source_scanner to None in the builder
> just to see if this made a difference, but no.
>
> How can I express a builder that builds header files from cpp files
> without creating a builder that build dependency cycles?
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170319/7f5e9907/attachment.html>
More information about the Scons-users
mailing list