[CMake] [CMAKE] problem with CMAKE_FIND_LIBRARY_SUFFIXES/FindBLAS/BLA_STATIC

Yngve Inntjore Levinsen yngve.levinsen at gmail.com
Wed Jul 6 03:06:43 EDT 2011


 Tirsdag 05 juli 2011 16.25.49 skrev Yngve Inntjore Levinsen :
> Dear developers,
> 
> I am having what looks like a problem with library suffixes which I am not able to figure out.
> 
> Essentially, our project has an option which when turned on adds a "-static" to the compiler flags. This then obviously need any libraries to be static if one should use them.
> 
> I then wanted to link against BLAS/LAPACK, but need to require that the suffix is e.g. .a when on a linux system. First I tried to set the "BLA_STATIC". However, it seems that even though I have a libblas.a in my /usr/lib/, it does not find it. It should be noted that libblas.a is a symbolic link to libgoto2.a which is another symbolic link to libgoto2_penrynp-r1.13.a. Unsure if this causes any problems (?).
> 
> Another user reported that instead of failing to find the libraries, it just went on using the dynamic libraries which he had on his system. Looking at how BLA_STATIC is defined, that makes sense if he didn't have the libblas.a in his system. Linking then failed obviously. 
> 
> I figured in our case it would be better to just set the CMAKE_FIND_LIBRARY_SUFFIXES ourselves, instead of using BLA_STATIC. However, I still have the problem that it does not find my libblas.a file. Anyone knows what I am doing wrong? I am using cmake version 2.8.4, and he is using Debian Sid (unsure which version of cmake, but I can check if it is important).
> 
> Cheers,
> Yngve
> 


Dear all,

I found the problem finally. What I did was mixing strings and lists (as I understand it), so I set the CMAKE_FIND_LIBRARY_SUFFIXES in this manner:

set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")

That did not work. Difficult for you to know that was what I did in any case, sorry for not adding that info in the first mail. Removing the "",  and then it worked:

set(CMAKE_FIND_LIBRARY_SUFFIXES .a)

In FindBLAS.cmake I find the following:
    if(BLA_STATIC)
      set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
    endif(BLA_STATIC)

I believe the second line should be 
      set(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
instead? (same fix goes for APPLE/WIN32 part) Or is there some other difference between lists and strings which I am unable to comprehend?

Cheers,
Yngve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110706/6230d626/attachment.htm>


More information about the CMake mailing list