[CMake] Fortran MinGW on Windows

Leek, Jim leek2 at llnl.gov
Fri May 31 04:22:28 EDT 2013


Actually, I'm not sure why it works on Linux either.  That really threw me.

That's for the tip on building shared.  That actually did work.  I would really like a static build, but I guess I'm just going to have to add an if(Windows) if(gfortran) clause or something, huh?

-----Original Message-----
From: Arjen Markus [mailto:arjen.markus at deltares.nl] 
Sent: Friday, May 31, 2013 1:03 AM
To: Leek, Jim; cmake at cmake.org
Subject: Re: [CMake] Fortran MinGW on Windows

Hi Jim,

I do not quite know why this works fine on Linux, but the issue is caused by the C++ part of the link step. As you are using g++ to link all the C++ runtime libraries, you need to tell it what Fortran runtime libraries to add.
Linking with gfortran automatically ensures all these libraries are taken into account. (If you were to use gfortran as the interface to the linker, then you would need to tell it what C++ runtime libraries are required.)

A way out would be to build these additional libraries as DLLs (shared objects), as then the language-specific linker can be used.

Regards,

Arjen

On Fri, 31 May 2013 07:51:34 +0000
  "Leek, Jim" <leek2 at llnl.gov> wrote:
> Hi, I recently rebuilt an old build system with cmake. 
> It works well on Linux, but part of the idea of using cmake was to 
>make it more portable.  Now I'm working on the Windows port, but I'm 
>having issues with the Fortran libraries.  The program itself is C++, 
>but it has a number of optional third party libraries, a few of which 
>are written in Fortran.  The weird thing is, when I do the final link, 
>I get a bunch of "undefined references"
>for stuff that's in the gfortran library.
> 
...
> 
> Thanks,
> Jim


 

DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited.
The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail.






More information about the CMake mailing list