[Cmake] Determining that the compiler "changed"

Amitha Perera perera at cs . rpi . edu
Tue, 30 Sep 2003 14:04:19 -0400


Hi all

Is there a reliable mechanism for determining that the compiler has
"changed"?

To elaborate: in the vxl project, one of the first things we do is run
a series of tests to determine the compiler capabilities. This can
take quite some time, which means that running CMake on the vxl source
tree takes a long time. However, these computed values do not change
often, so it'd be nice to avoid the re-checking unless the compiler
behaviour (potentially) changes.

Right now, my solution-in-the-brew is to cache the cmake compiler
variables and check if they've changed since the last time. That is, I
check ${X} against ${VXL_CACHED_X}, for X in CMAKE_C_FLAGS,
CMAKE_C_FLAGS_DEBUG", CMAKE_C_FLAGS_MINSIZEREL, CMAKE_AR,
CMAKE_SHARED_LINKER_FLAGS, CMAKE_STANDARD_LIBRARIES, and so on. Is
this the only way? If so, is there a definitive list of these
variables? Or is there some mechanism to determine at run-time what
these variables should be? (We can assume at least CMake 1.6.) I'd
like to make the mechanism as future-compatible as possible.

Thanks,
Amitha.