[CMake] Additional testing of bug #4772

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Sep 22 23:12:06 EDT 2008


On 2008-09-22 22:08-0400 Bill Hoffman wrote:

> Alan W. Irwin wrote:
>
>> 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.
>> 
>
> OK, thanks for trying it.
>
>
> I noticed that you only test with C/CXX.  Does the same thing happen with 
> Fortran?

I got in the habit of only testing C/CXX because there was an additional
obfuscating issue for g77 (see bug #4773).  However, few users have access
to g77 any more (including me).  Should I just close that g77-related bug
since it is so difficult to test it any more?

Anyhow, you made a good point about repeating the tests for gfortran
(specifically, gfortran version GNU Fortran (Debian 4.3.1-9) 4.3.1 on my
platform), and it works!

  PROJECT(free_eos C)
  ENABLE_LANGUAGE(Fortran)

==>

irwin at raven> grep '^CMAKE_[CF].*FLAGS_DEBUG' CMakeCache.txt |grep -v INTERNAL
CMAKE_C_FLAGS_DEBUG:STRING=-g
CMAKE_Fortran_FLAGS_DEBUG:STRING=-g

If I use ENABLE_LANGUAGE first that screws up the PROJECT command (just
like with C/CXX).

  ENABLE_LANGUAGE(Fortran)
  PROJECT(free_eos C)

==>

CMAKE_C_FLAGS_DEBUG:STRING=
CMAKE_Fortran_FLAGS_DEBUG:STRING=-g

I doubt many projects will try ENABLE_LANGUAGE before PROJECT so I think we
can just ignore the bad results in that case for Fortran, C, and CXX
(although it might be a good idea to generate an error message for that
out-of-order case).

> I think some of the C stuff gets initialized by CXX and CXX by C.
> However, Fortran should for the most part be separate. My guess is the fix 
> will go in the Platform directory.  If you have a C only project does it 
> create empty CXX vars that are not used?

No.  Notice that my search above would have picked out any CXX variables and
they weren't there.  I also tried project(free_eos C) alone and project
(free_eos CXX) alone, and there did not seem to be any empty vars of the
wrong kind in either case.  So there is no evidence from those tests of any
cross-talk between the two languages.

Now that we have an example of a working ENABLE_LANGUAGE for gfortran, I
agree with your assessment/guess that the CXX and C troubles for that case
are some screw up in one of the C and CXX (but not Fortran) enabling files
in Platform.  In fact I am on the track of something
(CMAKE_C_FLAGS_DEBUG_INIT appears not to be initialized for the generic
Linux case and also not for the specific gcc case in Platform) and will
report further later tonight or tomorrow.

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