Honest Guvnor wrote:
I am building a program with a C++ main (WxWidgets) and linking with C
and Fortran libraries. My problem is that on each platform I am
currently having to find the basic Fortran library (e.g. libg2c for
g77) and include it explicitly in the target_link_libraries list.

I have tried adding a dummy fortran file to the list of C++ files to
force it know about Fortran and get prompted to declare the
linker_language property. Setting this to C++ results in no change. I
have downloaded and installed the current version 2.4.8 with no
change. I have tried OSX and Linux with the same result. I have mixed
Fortran and C in another program without problems. A mix of C++ and C
was working in this program until the addition of the Fortran
libraries.


Well, you are sort of stuck...

You can change the default linker language for any target with this property:

SET_TARGET_PROPERITES( <tgt> PROPERTIES LINKER_LANGUAGE CXX)

Could be:

SET_TARGET_PROPERITES( <tgt> PROPERTIES LINKER_LANGUAGE Fortran)

However, you will have the same issue with C++ libraries being missing if you change the linker language to Fortran. Fortran and C are not really an issue since the c runtime is always there. However, Fortran and C++ are an issue...

You might be able to put the fortran stuff in a shared library and have the fortran runtime pulled in that way. You could write some fancy find_* fortran stuff using try-compile that finds out the fortran run time library.

-Bill

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to