On 2008-07-11 11:03-0400 Wheeler, Frederick W (GE, Research) wrote:


I'm trying to use CMAKE_CACHE_MAJOR_VERSION and
CMAKE_CACHE_MINOR_VERSION to determine which version of cmake is being
used, but it seems that these vars are not yet set during the first
cmake run.  This is demonstrated in a simple test case below.  CMake is
run twice, and you can see in the 'debug' prints are different on the
second cmake run.

Is there a better way to determine the cmake version being used?

If you are trying to distinguish cmake-2.6.x from prior versions, then
you can use the following (I use this when setting
2.6.x policies)

if(COMMAND cmake_policy)

An alternative that works for me for both 2.4.x and 2.6.x is the following
if statement

if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)

I assume you could also test on CMAKE_RELEASE_VERSION, but I haven't tried
that.

At least for 2.6.0, the cached versions of these variables are also
available.  This is what is in my current (2.6.0) cache.

grep VERSION CMakeCache.txt |grep CMAKE
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2
CMAKE_CACHE_MINOR_VERSION:INTERNAL=6
CMAKE_CACHE_RELEASE_VERSION:INTERNAL=patch 0

HTH.

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); PLplot scientific plotting software
package (plplot.org); 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
__________________________
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to