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

Paul Harris harris.pc at gmail.com
Tue Oct 21 04:54:02 EDT 2008


snip

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


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


I am in a vaguely similar position, and I can understand the desire to
specify the library on the command line (so that you can configure via a
selection of scripts that call cmake), rather than having to manually edit
the properties in ccmake.

Maybe instead, is it possible to set the value of BLAS_LIBRARIES via the
command line?  You would probably also want to set BLAS_INCLUDES too in case
you have different headers as well.

At the end of the day, FIND_PACKAGE()'s goal is to set the values of
numerous "standard" variables (eg BLAS_LIBRARIES)... so if you can do a
better job than cmake's automatic package finding tool, then it might be
easier to just specify the required variables yourself and remove the
FIND_PACKAGE call entirely.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081021/63ac36c9/attachment.htm>


More information about the CMake mailing list