<div class="gmail_quote"><div class="gmail_quote"><div><div></div><div class="h5">[posting to the list, since I accidentally replied only to Sergey]<br>On Thu, Apr 23, 2009 at 1:48 PM, Sergey Rudchenko <span dir="ltr"><<a href="mailto:sergey.rudchenko@gmail.com" target="_blank">sergey.rudchenko@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div>On Thu, 2009-04-23 at 13:37 +0300, Nikolay Mitev wrote:<br>
> Hi<br>
><br>
> I have the following situation:<br>
><br>
> files: test.cpp test.h<br>
><br>
> I want to process the file test.cpp with a custom pre-processor which<br>
> will generate, say, test.ii.cpp which will get compiled into<br>
> libtest.a. test.cpp just includes test.h.<br>
><br>
> This is my CMakeLists.txt file:<br>
><br>
> cmake_minimum_required(VERSION 2.6)<br>
><br>
> add_custom_command (OUTPUT test.ii.cpp<br>
> COMMAND preprocess test.cpp test.ii.cpp<br>
> DEPENDS test.cpp<br>
> COMMENT "Creating test.ii.cpp"<br>
> VERBATIM)<br>
><br>
> add_library (test test.ii.cpp)<br>
><br>
> All dandy, but when I modify test.h the preprocessing step is not run,<br>
> but just the compile step for test.ii.cpp. How can I make it so, that<br>
> when the header is modified the preprocessing and the compilation<br>
> steps are both run?<br>
<br>
</div></div>Did you try to list the test.h in the DEPENDS list?<br>
<font color="#888888"></font></blockquote></div></div><div><br>Yes, and this works, but I really don't want to keep this list up-to-date manually. The project involves hundreds of files, so I'm looking for a way to automate this. Is there a way to extract the dependencies of test.cpp and make test.ii.cpp depend on them?<br>
<font color="#888888"><br></font></div></div><br>Nikolay<br>
</div><br>