MantisBT - CMake
View Issue Details
0014802CMakeCMakepublic2014-03-10 16:062015-11-02 09:13
Gregor Jasny 
 
normalfeatureN/A
closedwon't fix 
CMake 2.8.12.2 
 
0014802: Add option to find_library to invalidate cache if hints or paths have changed
Hello,

in our build system we read the version of precompiled libraries with cmake from a file. This version and a well-known path suffix form the PATH attribute of the find_library (and similar) command.
But if the version is gets changed, cmake will be still using the cached entry.

My proposal is to add a parameter that changes the behaviour: Once the hints / paths, etc. to the find_library call changes, the cached result will be purged.

Currently I'm using a self-written function to achieve this behaviour but I think it is generic and useful enough to have it provided within cmake itself.

Thanks,
Gregor
No tags attached.
Issue History
2014-03-10 16:06Gregor JasnyNew Issue
2014-03-11 09:29Brad KingRelationship addedrelated to 0014803
2014-03-11 09:52Brad KingRelationship deletedrelated to 0014803
2014-03-11 11:43Brad KingNote Added: 0035387
2015-03-24 12:21Gregor JasnyNote Added: 0038286
2015-03-24 13:33Brad KingStatusnew => resolved
2015-03-24 13:33Brad KingResolutionopen => won't fix
2015-11-02 09:13Robert MaynardNote Added: 0039745
2015-11-02 09:13Robert MaynardStatusresolved => closed

Notes
(0035387)
Brad King   
2014-03-11 11:43   
One problem is that HINTS are sometimes computed from temporary information like environment variables at the time CMake first runs on a project. Then the result of the find_* command is cached so it does not matter if the same hint is available again later. When a CMakeLists.txt file is modified then the build system may invoke CMake to re-generate the project. The environment of that invocation can be different, and will cause a different set of HINTS to be computed. With the proposed behavior the find_* command would ignore the existing cached result and re-run but no longer have the possibly needed hint available.

In general a find_* command is unlikely to have enough information about when it should re-run to decide to invalidate the entry itself. It looks like in your use case you have code to unset(... CACHE) the values before the find_* calls when the loaded versions have changed. That is using case-specific information.
(0038286)
Gregor Jasny   
2015-03-24 12:21   
I added some custom functions to perform the invalidation. You could close this one.
(0039745)
Robert Maynard   
2015-11-02 09:13   
Closing resolved issues that have not been updated in more than 4 months.