[CMake] Caching calculated values.

Josef Karthauser joe.karthauser at geomerics.com
Mon Oct 22 11:49:09 EDT 2007


Full of questions me...!

As part of a cmake run a number of my CMakeLists.txt files do some
complex state-machine stuff to determine a list of files.  This takes
some time, and I want to avoid doing it unnecessarily.  However,
whenever a single CMakeLists.txt file in the tree changes, cmake runs
over the entire tree during the rebuilding of the dependencies, and so
this complex calculation is getting run unnecessarily.

As each set of calculations are connected to a single CMakeList.txt
file, it should be possible to avoid recalculating, and useing cached
values where possible.  In order to do that however I need to know
whether a CMakeLists.txt file is stale, with respect to the last time it
ran, or not.  Is there an easy way for me to determine from within a
CMakeLists.txt file, whether it is out-of-date?  That is, CMake must
know why it decided to rebuild the dependencies.  Is that information
available from at the macro level to the code being executed from a
given CMakeLists.txt file?

Joe


More information about the CMake mailing list