[CMake] Add external static libraries / ar-archives to a build.
Mathieu Malaterre
mathieu.malaterre at gmail.com
Tue Oct 21 04:34:07 EDT 2008
[keep the mail on cmake ml, pls]
On Tue, Oct 21, 2008 at 10:26 AM, Martin Köhler <martin.pleissa at web.de> wrote:
>>Von: "Mathieu Malaterre" <mathieu.malaterre at gmail.com>
>>Gesendet: 21.10.08 10:10:44
>>An: "Martin Köhler" <martin.pleissa at web.de>
>>CC: cmake at cmake.org
>>Betreff: Re: [CMake] Add external static libraries / ar-archives to a build.
>>
>>On Tue, Oct 21, 2008 at 10:06 AM, Martin Köhler <martin.pleissa at web.de> wrote:
>>> Hi,
>>> I'm working on a library to solve sparse linear systems. All basic vector operations are realized by using the BLAS. The FindBLAS works fine but most of the blas implementations are provided as an ar-archive somewhere in the filesystem ( we use a standard blas, ATLAS, GotoBlas or malefactor specific variants). Is it possible to pass the wanted libblas.a as a parameter to cmake and add it to a target?
>>> For example when I want to use the GotoBLAS I want to call cmake this way:
>>> cmake -DBLAS=/path/to/lib/libgoto.a PATH_TO_SOURCE
>>>
>>> If I link the lib manually I enter
>>> gcc -o output myfile.c /path/to/lib/libgoto.a
>>
>>FIND_PACKAGE(BLAS REQUIRED)
>>
>>ADD_EXECUTABLE(output myfile.c)
>>TARGET_LINK_LIBRARIES(output ${BLAS_LIBRARIES})
>>
>
> This way already works fine(I already noticed) but it is not that flexible I need for the project. I need to specify the ar-archive that contain the blas routines myself. The Find_package macro mostly finds the wrong blas that I don't want to use.
I do not understand what you mean. there is no 'wrong' library, cmake
just pick the first one based on your environment. If you have
multiple installation of blas, I do not see how cmake could guess
which one you want.
> In my opinion the best way is to pass the right file as parameter. The cause is that the choose of the blas implementation is very important to solve the problems as fast as possible and so I want an easy way to switch which blas is used.
Either run it via ccmake and changed whatever option is "wrong".
reading the code of FindBLAS.cmake there is apparently a subtle
mechanism which rely on the setting of "BLA_VENDOR", change this value
until you are happy with cmake system inspection (neither did I wrote
this module, nor did I ever used it...)
2cts
--
Mathieu
More information about the CMake
mailing list