[CMake] Add external static libraries / ar-archives to a build.

Mathieu Malaterre mathieu.malaterre at gmail.com
Tue Oct 21 04:09:22 EDT 2008


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})

2cts
-- 
Mathieu


More information about the CMake mailing list