[CMake] Forcing CMake to rerun

Nicholas Clark nicholas.clark at gmail.com
Thu Dec 10 16:26:47 EST 2015


Hi all,

I'm working on using CMake to create a build system that targets an
incredibly hard-to-deal-with IDE/build system, used for doing some embedded
programming (Xilinx's Vivado suite).

One of the pieces I need to get working is a conditional dependency between
two files (a project-file generator script that gets archived in Git, and
the actual project files that get generated).

The graph basically looks like this:

Path 1: .tcl file (in Git) -> .xpr file (used by IDE)
Path 2: .xpr file (after a user changes something in the IDE) -> .tcl file
(needs to be regenerated)

So on any clean build, the source-controlled TCL file autogenerates a bunch
of required project files. On iterative builds at a developer's desk, he
might change some IDE setting and then the TCL file needs to be regenerated
(without triggering a rebuild of the project files as well). It's kind of a
conditional and/or psuedo-circular dependency.

In pure GNU Make, I can express a conditional dependency with an 'if'
statement that uses timestamp checks. It's also easy for me to express this
dependency in CMakeLists.txt - I can check the file timestamps, and I can
conditionally emit the relevant custom_target/custom_rule.

That only works when CMakeLists.txt gets parsed, however. Is there any way
for me to force a CMake-generated Makefile to _always_ rerun CMake before
trying to build the 'all' target? If not, is there any other clever way
that I could express this conditional dependency?

-Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151210/df7d25f4/attachment-0001.html>


More information about the CMake mailing list