[CMake] C++ with BLAS

Matt Terry matt.terry at gmail.com
Fri Mar 5 15:36:50 EST 2010


is linking to shared libraries acceptable?  if so, you should be able
to link to libblas.so and you'll get the dependencies automatically.

On Fri, Mar 5, 2010 at 3:47 AM, Michael Wild <themiwi at gmail.com> wrote:
>
> 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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list