[CMake] Additional testing of bug #4772

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Sep 22 21:54:16 EDT 2008


Hi Bill:

I am going to change the subject line since this is now morphed into
a different topic.

On 2008-09-22 20:12-0400 Bill Hoffman wrote:

> I am thinking if you have the enable_language BEFORE the project command it 
> will get around the bug, and work as you want it to.

That doesn't work quite like expected so it cannot be used for a workaround,
but variations on that theme give interesting results that may allow you to
figure the bug out.

If the CMakeLists.txt file contains just

  ENABLE_LANGUAGE(C)
  PROJECT(free_eos CXX)

then

irwin at raven> grep '^CMAKE_C.*FLAGS_DEBUG' CMakeCache.txt |grep -v INTERNAL
CMAKE_CXX_FLAGS_DEBUG:STRING=
CMAKE_C_FLAGS_DEBUG:STRING=-g

i.e., ENABLE_LANGUAGE does work if used before PROJECT as you conjectured,
but then the result from PROJECT is screwed up which is a new (but
disappointing) result that makes this pattern unsuitable for a workaround, but
which may lead you to the source of this error.

Other variations of interest.

(1)
  PROJECT(free_eos NONE)
  ENABLE_LANGUAGE(C)
  ENABLE_LANGUAGE(CXX)

==> 
CMAKE_CXX_FLAGS_DEBUG:STRING=
CMAKE_C_FLAGS_DEBUG:STRING=

i.e., ENABLE_LANGUAGE never works properly for any language if done
after PROJECT.

(2)
  ENABLE_LANGUAGE(C)
  ENABLE_LANGUAGE(CXX)
  PROJECT(free_eos NONE)

==>
CMAKE_CXX_FLAGS_DEBUG:STRING=
CMAKE_C_FLAGS_DEBUG:STRING=-g

(3)
  ENABLE_LANGUAGE(CXX)
  ENABLE_LANGUAGE(C)
  PROJECT(free_eos NONE)

==>
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
CMAKE_C_FLAGS_DEBUG:STRING=


i.e, from result (2) and (3) if ENABLE_LANGUAGE commands are specified
before PROJECT, the first one works but not subsequent ones which also makes
this pattern unsuitable as a possible workaround.

(4)
  PROJECT(free_eos C CXX)
==>
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
CMAKE_C_FLAGS_DEBUG:STRING=-g

i.e., the only pattern that gives the correct result is one that does not
use ENABLE_LANGUAGE.

I did all the above tests with 2.6.0, but previously I have shown the CVS
version of CMake had similar problems.

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
__________________________


More information about the CMake mailing list