[CMake] Alternative to toolchains (Was IBM Fortran and the C Preprocessor)
Will Dicharry
wdicharry at stellarscience.com
Wed Jun 24 18:22:55 EDT 2009
I'm splitting into a new thread because these are two distinct topics now.
Bill Hoffman wrote:
> Will Dicharry wrote:
>
>> We do this because we need a quick way to choose our compiler (cmake
>> chooses GNU on this system by default, and we have to use an MPI
>> wrapper compiler) and because we want those particular Fortran flags
>> when the MPI wrapper compiler is being used.
>> When I use this toolchain file, the Fortran compiler ID is unknown (I
>> failed to see this before, the C and CXX compiler IDs were correct).
>>
>> However if I comment out the set CMAKE_Fortran_FLAGS line or if I skip
>> the toolchain file altogether and just pass
>> -DCMAKE_Fortran_COMPILER=mpxlf90 into the cmake command, the compiler ID
>> is VisualAge and everything works fine.
>>
>> Am I misusing the toolchain file capability?
>>
> Yes, that should only be used for cross-compiling.
>
> To set the compilers you can set the environment variables FC, CC, and
> CXX before running CMake.
>
That's usually the way I do it too when I'm developing. However, our
users generally grab the source code for our application and copy it to
multiple sites with greatly varying platforms and many compilers to
choose from. The reason I chose to use toolchains to do this is it gave
me a way to place our officially supported compilers with the right
flags in a toolchain file and provide the users with a simply named file
that did the right thing on a given machine. This lets them build with
something like
$ cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/source/toolchain/host.cmake \
> /path/to/source
rather than needing environment variables. Also, on some platforms we
actually are cross compiling since the backend compute nodes use a
different OS than the login nodes. Using a toolchain file for
everything ensures that my users need to learn only one process. I'd
prefer it if we just distributed binaries packaged with CPack, but
that's just not possible in our environment.
I'd prefer not to wrap shell scripts around the build system, I'm
curious to know if anyone knows of another way to achieve something
similar in CMake.
Thanks,
Will
--
Will Dicharry
Software Developer
Stellar Science Ltd Co
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3344 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090624/c0618599/attachment.bin>
More information about the CMake
mailing list