[CMake] LINKER_LANGUAGE Fortran C CXX project

Alan W. Irwin irwin at beluga.phys.uvic.ca
Tue Aug 7 14:35:33 EDT 2007


On 2007-08-07 11:02-0700 Marie-Christine Vallet wrote:

> Hi,
> I have C++ Fortran project, and cannot seem to set the  linker_language of 
> the project. What am I doing wrong?
> Any suggestion?

PLplot used to have a library built from Fortran and C.  It worked okay on
Linux, but caused nothing but trouble on other platforms so we split the
library into two libraries, one containing fortran objects and one containing
C objects, and my life has been much more peaceful ever since.... :-)

So if you cannot get a library with mixed Fortran and C++ objects to build
properly, splitting it will work at least in the case where all Fortran
code depends on C++ code or all C++ code depends on Fortran code.  Of course,
splitting a library is a bad idea if the resulting two libraries depend on
each other so I don't recommend this course if you have both Fortran code
depending on C++ code and C++ code depending on Fortran code in your library.


> --- CMakeLists.txt
> PROJECT(skinmesh Fortran CXX C ) # the name of your project
>
> SET_TARGET_PROPERTIES(${TARGET}
>       PROPERTIES
>       LINKER_LANGUAGE Cxx)

According to the documentation that should work if Cxx is changed to CXX.

>
>
> -----------------------------------------------------------
>
> I also tried this but it does not work either.
>
> --- CMakeLists.txt
> PROJECT(skinmesh Fortran CXX C ) # the name of your project
>
> SET(LINKER_LANGUAGE CXX)

I believe SET_TARGET_PROPERTIES is the way to go rather than SET.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list