[CMake] What's the best way to support additional compilers for an "official" CMake language such as Fortran

Arjen Markus arjen.markus at deltares.nl
Tue Jan 26 08:50:44 EST 2010


Hi Brad,

On 2010-01-26 14:37, Brad King wrote:
> Arjen Markus wrote:
>> I tried to do this, using the Compaq Visual Fortran compiler as a test
>> case, as I can do that rightaway, but I ran into some trouble:
> 
> Okay, I didn't expect this one to work yet.
> 
> The MinGW and Cygwin versions of gfortran should work though.
> Please confirm this when you get a chance.

Will do - Cygwin is not installed on the laptop I used, but MinGW is.

> 
>> - CMake complained at first about f90 - the -o option is ambiguous IIRC
> 
> Without the Compaq compiler info files CMake has no idea how to construct
> the compiler command line, so it guesses with unix conventions.  This is
> not surprising.
> 
>> - There were no output files created in the working directory, but there
>>   was a message that all was fine.
> 
> What was the actual CMake output log?
> 
>> - I tried to reproduce the error messages, but CMake reacts differently
>>   now: there is no indication it is trying to find a Fortran compiler,
>>   and it is finished very fast indeed.
>>
>> Is it storing the cached information in another location than the
>> current (working) directory? If so, which is it?
> 
> There is also a CMakeFiles subdirectory in which compiler information
> is kept outside of CMakeCache.txt so that it can be shared with the
> try_compile projects.  Generally you should keep the source tree totally
> clean and always use outside build trees.  That way you can just wipe
> out the build tree to start fresh.
> 

My usual procedure is this:
- Clean out the directory I want to build in (no subdirectories, no
   files)
- Start a batch file or shell script which refers to the correct
   version of CMake and the correct CMakeLists.txt file with all
   the options I want to use

I did it this way just now too, but I found out that the intermediate
files are stored in the directory containing the CMakeLists.txt file!
This is the command I used:

"c:\program files\cmake 2.8\bin\cmake" ..\plplot\CMakeLists.txt -G 
"NMake Make files"

in the directory build-windows ...

Actually, the entire source directory now contains subdirectories
like CMakeFiles.

This is weird - I have never seen it do this before. The only
changes I made to the CMake part of PLplot were: move two files
out of the way and remove their inclusion from the
language_support.cmake file to avoid error messages.

Regards,

Arjen


More information about the CMake mailing list