[CMake] fortran flags in a c++ linked executable

James C. Sutherland James.Sutherland at utah.edu
Tue Mar 31 14:30:26 EDT 2009


Let me try this again.

I have a f90 subroutine that performs file IO.  I would like to link  
that with a C++ driver.

If I use a fortran driver, I am able to set the binary format via
	set( CMAKE_Fortran_FLAGS "-fconvert=big-endian" )
This results in file IO in big-endian format.

When using the C++ driver, (linking with g++), I cannot get things  
working properly.  I have tried various compiler settings:

	add_definitions( -Xlinker -fconvert=big-endian )	  # links, but does  
not affect endian-ness
	add_definitions( -Wl,-fconvert=big-endian )	  # links, but does not  
affect endian-ness
	add_definitions( -mbig-endian )  # does not work - link fails with  
unrecognized flag

None of these result in an executable that properly handles big-endian  
file formats.

The system I am compiling on is a little-endian system (intel Mac)  
with gfortran 4.4.0 and g++ 4.0.1.


More information about the CMake mailing list