[CMake] C++ with BLAS
Michael Wild
themiwi at gmail.com
Fri Mar 5 04:47:05 EST 2010
On 5. Mar, 2010, at 9:25 , Nico Schlömer wrote:
> Hi,
>
> I build my C++ application here with CMake which works rather fine,
> except for one minor glitch:
> The application needs to link against BLAS, which I specify as
>
> TARGET_LINK_LIBRARIES( /path/to/blas/libblas.a )
>
> This gets included alright, but libblas -- written in Fortran -- in
> turn needs symbols from libgfortran.a. This library, however, is never
> automatically included; I have to manually specify it.
>
> Any way to automate this?
>
> Cheers,
> Nico
CMake can't possibly know it needs libgfortran.a, since a static library is just a "zip-file" of object files. Either specify the libgfortran.a library in the target_link_libraries call, or use gfortran as your linker by adding Fortran to your project() call and then setting the LINKER_LANGUAGE to Fortran. Of course, you still need to make sure that the Fortran compiler that CMake finds actually is gfortran...
Michael
More information about the CMake
mailing list