One way that might work would be to configure a header file that contains a string representing the options of interest.<div><br></div><div>Then include that header file in *all* source files that you want to rebuild.</div>
<div><br></div><div>When you change options in CMake and configure the header, it will only change if something has changed, and then it will trigger a rebuild of the source files that include it. For this to work reliably you'd have to include that header in every source file in a given library or executable.</div>
<div><br></div><div>I realize the downside of this approach, but it may work for your situation better than saying "tell your developers to clean and rebuild everything when they change an ADD_DEFINITION"....</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div><br><div class="gmail_quote">On Wed, Dec 10, 2008 at 12:25 AM, Philip Lowman <span dir="ltr"><<a href="mailto:philip@yhbt.com">philip@yhbt.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d">On Tue, Dec 9, 2008 at 1:08 PM, Philip Lowman <span dir="ltr"><<a href="mailto:philip@yhbt.com" target="_blank">philip@yhbt.com</a>></span> wrote:<br>
</div><div class="gmail_quote"><div class="Ih2E3d"><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
This is a known problem. Visual Studio has no way of knowing that the<br>
compiler flags changed in a project file CMake is writing to.<br>
<br>
I would love to see a patch for this for CMake 2.8.</blockquote></div><div><br>One thought I had here was to have the "vcbuild" command clean any affected projects. This would have the advantage of isolating CMake from implementing any Visual Studio specific mods (i.e. delete these object files to force a recompilation, etc.). This would have some downsides though.<br>
<br>1. The easiest implementation would just be to perform the clean if a project file changes. This would result in more cleaning then necessary as changing source files (for example) shouldn't cause a rebuild. Certain project modifications like adding a source file to a target shouldn't cause a clean of that target.<br>
<br>2. Perhaps the biggest gotcha of all, "cleaning" a target would wipe out any binaries/libraries already generated. This is far different from the behavior of CMake's Makefile generator which simply causes targets to be rebuilt on the next "make".<br>
<br>Anyone have any ideas for fixing this? I've been bit by this one before (forgetting to rebuild everything when I change a preprocessor definition at the global scope).<br><br></div></div><br>-- <br><font color="#888888">Philip Lowman<br>
</font><br>_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org">CMake@cmake.org</a><br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>