View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009195CMakeModulespublic2009-06-22 16:242009-07-29 16:44
ReporterWill Dicharry 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0009195: Find module for linking mixed Fortran/C code
DescriptionWhen linking a Fortran library from C/C++ code, it is necessary to link the Fortran run-time libraries. Attached is a find module that attempts to do this in a portable way by compiling a simple test verbosely and scraping the output for -L and -l flags. The module has been tested on the following OS/Compiler combinations:
- Linux/GNU
- Linux/Intel
- Linux/PGI
- AIX/VisualAge
TagsNo tags attached.
Attached Files? file icon FindFortran.cmake [^] (3,691 bytes) 2009-06-22 16:24

 Relationships

  Notes
(0016951)
Brad King (manager)
2009-07-23 10:15

I've implemented automatic detection of implicit link libraries and search directories for C, C++, and Fortran compilers. There is a new undocumented, internal-only module which does the parsing:

  Modules/CMakeParseImplicitLinkInfo.cmake

The results are stored in variables

  CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES
  CMAKE_<LANG>_IMPLICIT_LINK_DIRECTORIES

but they are not meant for user consumption. A future commit will make automatic use of them for mixed-language link line computation.

I've added a test file:

  Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in

which hard-codes a bunch of examples from several platforms and tests that the parser works as expected.

I've tested this with GNU, MIPSpro, HP, VisualAge, SunPro.
(0016952)
Brad King (manager)
2009-07-23 10:19

Detection takes place during the "Detecting <lang> compiler ABI info" step.

In order to enable this for a new compiler, make sure that CMAKE_<LANG>_COMPILER_ID is computed correctly. Then add a module

  Modules/Compiler/<id>-<lang>.cmake

containing a line like

  SET(CMAKE_<lang>_VERBOSE_FLAG "-v")

The language <lang> can be one of "C", "CXX", or "Fortran".

The ABI detection code passes this flag to its test project and parses the compiler output to extract the link line.
(0016953)
Brad King (manager)
2009-07-23 10:20

Currently I do not have access to Intel or PGI compilers. Can you please test CVS HEAD CMake on these compilers?
(0017014)
Brad King (manager)
2009-07-29 16:44

I've committed support for Intel and PGI too.

CMake now automatically handles fortran libraries, so there is no need for users to find them.

 Issue History
Date Modified Username Field Change
2009-06-22 16:24 Will Dicharry New Issue
2009-06-22 16:24 Will Dicharry File Added: FindFortran.cmake
2009-06-22 16:45 Brad King Status new => assigned
2009-06-22 16:45 Brad King Assigned To => Brad King
2009-07-23 10:15 Brad King Note Added: 0016951
2009-07-23 10:19 Brad King Note Added: 0016952
2009-07-23 10:20 Brad King Note Added: 0016953
2009-07-29 16:44 Brad King Note Added: 0017014
2009-07-29 16:44 Brad King Status assigned => closed
2009-07-29 16:44 Brad King Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team