[CMake] linking fortran libraries with C++ with IBM XL compilers

Jeongnim Kim jnkim at ncsa.uiuc.edu
Sat Oct 30 15:31:41 EDT 2010


Hello,

I'm trying to compile C++ codes with IBM XL compilers. 

I enabled Fortran in the main CMakeLists.txt
enable_language (Fortran)
then  the default link inserts
 -lxlf90 -lxlf -lxlomp_ser

Since my applications use openmp, it is necessary not to link these libraries.
These libraries invalidate openmp environments at run time and make threads run serially.

I tried to overwrite 
SET(MAKE_Fortran_IMPLICIT_LINK_LIBRARIES "xlf90_r")
in my toolchain file but the three libraries are linked automatically.

Is there any way to prevent this from happening?

If I do not enable fortran by commenting out #enable_lanague(Fortran)
and link the needed libraries by hand, compilation works but of course then I have to use very ad-hoc methods to compile fortran subroutines. 

Similar problems are encountered with autoconf/automake. I would appreciate anyone with experiences with XL compilers in handling the multi-language applications.

Thanks in advance,
Jeongnim










More information about the CMake mailing list