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

Martin Köhler martin.pleissa at web.de
Tue Oct 21 10:52:08 EDT 2008


When I pass the absolute path of the ar-archive it seems to work. It's not the perfect solution because it doesn't check if the lib could be linked to the other files. 



-----Ursprüngliche Nachricht-----
Von: "Paul Harris" <harris.pc at gmail.com>
Gesendet: 21.10.08 10:54:12
An: "Mathieu Malaterre" <mathieu.malaterre at gmail.com>
CC: cmake at cmake.org
Betreff: Re: [CMake] Add external static libraries / ar-archives to a build.



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.







____________________________________________________________________
Psssst! Schon vom neuen WEB.DE MultiMessenger gehört? 
Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123



More information about the CMake mailing list