[CMake] Caching calculated values.

a.neundorf-work at gmx.net a.neundorf-work at gmx.net
Mon Oct 22 12:00:48 EDT 2007


On Monday 22 October 2007 17:49, Josef Karthauser wrote:
> 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?

No, and I think it shouldn't be necessary.
Using SET(... CACHE [FORCE] ) you can put stuff in the cache, also flags which 
show something has already been done.

Can you post how this complex calculation looks ?

Alex


More information about the CMake mailing list