I think I've settled on using configure_file to generate a cmake script that executes the custom command for each add_custom_command that I care about. I'll then add a dependency to this cmake script. This way I can detect the changes in arguments for each individual command regardless of how the arguments got filled in. There are other reasons for doing this (such as deleting the output file if the command fails), but this issue pushed it over the edge.<br>
<br>One possible tractable solution for CMake to do this would be similar. Each custom command gets its own file somewhere in the CMakeFiles directory or within the target's build directory. It then places a dependency on that file with the custome command's rule. When CMake configures it can generate the command and compare it to the one in the file and update the file as needed.<br>
<br>James<br><br><div class="gmail_quote">On Tue, Oct 28, 2008 at 2:36 PM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.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;">
You imagine correctly. :-)<br><br><div>We'll leave it up to the project CMakeLists authors...<br><div><br></div><div>File level dependencies are easy to communicate to make-based or Visual-Studio-project-based build systems. Variable value changes, not so easy to communicate. But you don't want *all* custom commands to rebuild whenever CMakeCache.txt or CMakeLists.txt changes, and some CMake variables may be set in included CMake files and then used as custom command args later... etc. etc. It is probably a way cool feature, but seriously complex.</div>
<div><div></div><div class="Wj3C7c">
<div><br></div><div><br><div class="gmail_quote">On Tue, Oct 28, 2008 at 4:00 PM, James Bigler <span dir="ltr"><<a href="mailto:jamesbigler@gmail.com" target="_blank">jamesbigler@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;">
I haven't tried that, and I think it could work if I could make sure I kept track of all the possible variables that could go into making the arguments.<br><br>Is there something fundamental about CMake that would prevent it from detecting this change? I'm guessing that CMake would have to keep a record of all the custom commands that exist in a project and then compare them upon regeneration. I imagine that would not be an easy task.<br>
<font color="#888888">
<br>James</font><div><div></div><div><br><br><div class="gmail_quote">On Tue, Oct 28, 2008 at 1:52 PM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.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;">
You should be able to configure a file into your binary directory that references all the option variables of interest and then make a dependency on that file for your add_custom_command.<br><br><div>That way, the file will change only if one of the options changes in cmake and the dependency on it should trigger a re-run of the custom command...</div>
<div><br></div><div>Have you tried that?</div><div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div><br></div><div><br><div class="gmail_quote"><div><div></div><div>On Tue, Oct 28, 2008 at 3:45 PM, James Bigler <span dir="ltr"><<a href="mailto:jamesbigler@gmail.com" target="_blank">jamesbigler@gmail.com</a>></span> wrote:<br>
</div></div><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>I have a project that makes use of a add_custom_command that generates some cpp files from a given input file. The command can have different arguments depending on some CMake OPTION variables.<br>
<br>If I change the option variables from the CMake GUI, configure and regenerate the Visual Studio projects, are the add_custom_commands supposed to be run again? Currently they are not.<br>
<br>I would argue that the add_custom_command should be rerun if any of the commands change via editing the CMakeLists.txt file or by a configuration modification.<br><br>Has anyone come up with a mechanism to work around this issue?<br>
<br>CMake: 2.6.2<br>VS 2005 (32/64 bit)<br>WinXP 64<br><br>Thanks,<br><font color="#888888">James<br>
</font><br></div></div>_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org" target="_blank">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>
</blockquote></div><br>
</div></div><br>_______________________________________________<br>
CMake mailing list<br>
<a href="mailto:CMake@cmake.org" target="_blank">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></div></div></div>
</blockquote></div><br>