<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.6.4">
</HEAD>
<BODY>
Hi all.<BR>
<BR>
I've got a situation where I'm creating generated source files (from bison/flex, actually, but I'm writing my own rules for it since I need specialized support for C++ output, etc.)<BR>
<BR>
However I need to compile the generated output into two different libraries, building two different ways (with different #defines/compiler flags).<BR>
<BR>
So I have tried using add_custom_command() with OUTPUT, but the documentation says: <BR>
<BR>
<BLOCKQUOTE>
    &quot;Do not list the output in more than one independent target that may build in parallel or the two instances of the rule may conflict (instead use add_custom_target to drive the command and make the other targets depend on that one).&quot;<BR>
</BLOCKQUOTE>
<BR>
Sure enough, it seems that if I have my different libraries depend on these outputs I get problems during parallel builds.&nbsp; So then I tried to use add_custom_target(), but that says:<BR>
<BR>
<BLOCKQUOTE>
    &quot;The target has no output file and is ALWAYS CONSIDERED OUT OF DATE&quot;<BR>
</BLOCKQUOTE>
<BR>
and, sure enough, if I do it this way my source files (and everything that depends on them) rebuild every time I run the build, even if nothing has changed.&nbsp; This is a big bummer.<BR>
<BR>
<BR>
How can I have generated source files compiled different ways into different libraries, but not have them (and anything that depends on them) rebuilt every time?<BR>
<BR>
<BR>
The only way I've thought of so far is to have two different add_custom_command() options with the same input but different output (in different directories maybe), one for each target.&nbsp; This means I need to generate the files twice even though the output source files will have identical content.&nbsp; But as long as I don't have to REBUILD them every time maybe that's not so bad.&nbsp; I haven't tried this yet though.&nbsp; Are there other options?
</BODY>
</HTML>