[CMake] ExternalProject overwrites cache entries

Sascha Zelzer s.zelzer at dkfz-heidelberg.de
Thu Jul 7 08:13:53 EDT 2011


Hi,

We are using the ExternalProject macro to configure and build some 
external (CMake-based) dependencies and we populate their cache by 
providing a

CMAKE_ARGS
   -Dproj_var:type=bla

argument to ExternalProject. If we now change the CMake option 
"proj_var" in the external project itself (after it was successfully 
configured via the ExternalProject call), a re-run of the  
ExternalProject configure step overwrites the changed variable again. 
The CMake documentation states that the arguments given to "-D" have 
precedence over cache entries, so this behavior is expected.

In CMake 2.8.4, the ExternalProject macro gained a CMAKE_CACHE_ARGS 
argument, which writes a cache file and invokes cmake with "-C 
<cache_file>". However, the changed cache values are still overwritten 
because the cache file contains "SET(proj_var ... FORCE)" entries.

Is there a known workaround to prevent overwriting changed variables in 
external projects? Is the FORCE argument necessary in the created cache 
file?

Thanks,
Sascha


More information about the CMake mailing list