[CMake] IBM Fortran and the C Preprocessor

Will Dicharry wdicharry at stellarscience.com
Tue Jun 23 17:29:46 EDT 2009


Hi All,

We build on an IBM AIX system with the VisualAge compilers.  We have 
some Fortran code that depends on being preprocessed by the C 
preprocessor.  Like most Fortran compilers, IBM's Fortran compiler 
automatically runs cpp on *.F files.

It appears that add_definitions() places -DWHATEVER in the compile 
command line on all Unix variants.  Unfortunately, IBM's Fortran 
compiler uses -D as a compile flag for something other than adding a 
preprocessor definition.  In order to pass a preprocessor definition, 
you have to use -WF,-DWHATEVER.  So, if you call add_definitions() 
anywhere in the tree above a Fortran target, you end up with a compile 
error since CMake adds -D to the compile line and IBM expects this to 
mean something else.

I'm trying to figure out the best way to deal with this problem, and 
whether or not this is a bug in CMake's implementation on VisualAge 
compilers.

Does anyone have a suggestion?  If it is a bug, is there a workaround 
that we can use in the interim?  Also, if it is a bug, what would be 
involved in fixing it, and is there any way we can assist in either 
fixing it or testing a possible fix?

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/20090623/80304f22/attachment.bin>


More information about the CMake mailing list