[CMake] Mixed Fortran and C sources with Visual Studio 10

Bill Hoffman bill.hoffman at kitware.com
Tue Oct 22 13:45:35 EDT 2013


On 10/22/2013 11:04 AM, Brian Wainscott wrote:
> Arjen,
>
> Thanks -- that was more or less what I understood also.  And I was thinking about
> that approach, but frankly just expected that if that was a limitation of VS, and
> cmake builds for VS, then cmake should do that for me.  I'm just surprised it
> doesn't, and was hoping someone would know of a simple way to tell cmake to build
> two separate project files for me.

Hi,

I have thought about CMake doing something automatically here, however, 
it could get tricky pretty fast, and it is pretty easy to fix in the 
CMake file of the project.

Your example would be:

enable_language(Fortran)
enable_language(C)
add_library(tst_lib_f tst.F)
add_executable(tst  cfunc.c)
target_link_libraries(tst tst_lib_f)

You run into trouble with things like shared libraries.   However, it is 
not impossible.   There just has not been enough interest to date in 
implementing this feature.

-Bill




More information about the CMake mailing list