Method to force a rerun of cmake

In the same manner that all CMakeLists.txt (and other) files cause an out of date mode for the cmake system itself, where if you modify one of the cmake files, cmake is automatically re-run. In visual studio this is part of the ZERO_CHECK targets I believe

Is there anyway to have an arbitrary file do the same?

The issue is this. I have a version.h file, that is used in the application. I also use file( read …) to scrape the necessary parameters out of the file for the CPACK variables.

It works great, however, when I rev the version, I need to remember to re-run cmake, to update the CPACK variables.

I would like to automate this. Any suggestions?

You can use the CMAKE_CONFIGURE_DEPENDS directory property to do this.

1 Like

I have been looking for this variable for years!!! Thanks.

I had actually created a custom command to do this, but it always seemed like a hack.

Thanks. I was able to get it working.