[CMake] Fortran program linked with C++ library

2013-08-31 Thread Marcin Wojdyr
Hello, What's the best practice for linking Fortran program with C++ library? The library is external, built using autotools, either dynamic or static. The problem is that runtime c++ library is not linked when the library is static. I though that the recommended way to deal with it is: set_prope

Re: [CMake] Fortran program linked with C++ library

2013-09-03 Thread Brad King
On 08/31/2013 10:50 AM, Marcin Wojdyr wrote: > What's the best practice for linking Fortran program with C++ library? > The library is external, built using autotools, either dynamic or static. > > The problem is that runtime c++ library is not linked when the library > is static. > I though that

Re: [CMake] Fortran program linked with C++ library

2013-09-03 Thread Marcin Wojdyr
On 3 September 2013 15:46, Brad King wrote: >> I though that the recommended way to deal with it is: >> >> set_property(TARGET ${prog} PROPERTY LINKER_LANGUAGE CXX) > > This tells CMake that your "main" is provided by C++, but IIUC > it is still Fortran. You should still be able to link with the

Re: [CMake] Fortran program linked with C++ library

2013-09-03 Thread Brad King
On 09/03/2013 01:57 PM, Marcin Wojdyr wrote: > On 3 September 2013 15:46, Brad King wrote: >> One way to do this is to tell CMake that the library uses C++ >> using the IMPORTED_LINK_INTERFACE_LANGUAGES property on an > > That's what I was looking for, but for me instead of adding C++ > runtime,

Re: [CMake] Fortran program linked with C++ library

2013-09-04 Thread Marcin Wojdyr
Thanks, it works. Since the library is found in Find* script, I have to check if it is static. So I ended up with this: if("${MMDB_LIBRARY}" MATCHES "\\.a$") # it cannot be just "UNKNOWN IMPORTED", because # IMPORTED_LINK_INTERFACE_LANGUAGES is respected only for "STATIC IMPORTED" add_libra