[CMake] check_c_source_compiles caching pitfalls

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Apr 22 21:48:56 EDT 2017


On 2017-04-22 18:16-0700 Tyson Nottingham wrote:

> The result of check_c_source_compiles and similar commands
> (check_c_source_runs, check_cxx_source_compiles, etc.) is cached by the
> variable name passed in. This caching makes those commands and ones that
> depend on them easy to misuse.

To deal with cached variables that you want to reuse this way try the
unset command <https://cmake.org/cmake/help/latest/command/unset.html>
within the loop.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list