On 02/14/2011 10:02 AM, Yngve Inntjore Levinsen wrote: > If you want everything linked statically I believe you can use the variable, > BUILD_SHARED_LIBS, something like > OPTION( BUILD_SHARED_LIBS "Set to OFF to build static libraries" OFF ) > I do believe it will still use dynamic libraries if static aren't available, > but I am unsure about that part.
No, BUILD_SHARED_LIBS decides whether the *project's* libraries which have been declared without the STATIC/SHARED flag are built as static or shared, but it has no influence which kind of *external* libraries is picked up to link against. Regards, Michael > On Sunday 13 February 2011 12:08:58 AM Dominik Szczerba wrote: >> Yes, full paths seem to work fine for me. >> Many thanks for your feedback! >> >> Dominik >> >> On Sat, Feb 12, 2011 at 11:11 PM, Michael Hertling <mhertl...@online.de> >> wrote: >>> On 02/12/2011 09:39 PM, Andreas Pakulat wrote: >>>> On 12.02.11 21:20:58, Dominik Szczerba wrote: >>>>> I never actually saw a solution to this problem in cmake: >>>>> I need to link (independent constraint from above) with libguide.a and >>>>> not libguide.so (in intel compiler, does not matter much), but both >>>>> are available, and cmake always takes the shared one when given >>>>> "guide" as the desired library to be linked. >>>>> Is there an elegant way of static linking (other than -static passed >>>>> to the linker for static linking of everything) of this particular lib >>>>> other than hacking (like deleting the .so from the folder)? >>>> >>>> No, i.e. no elegant way. What you can do is force cmake to search only >>>> for .a files by setting a cmake variable, unfortunately I don't remember >>>> which one and can't easily find it right now. The archive of this list >>>> has more info as well as the cmake manual or the FAQ on the cmake >>>> website. >>>> >>>> Andreas >>> >>> Hi Dominik, >>> >>> it's CMAKE_FIND_LIBRARY_SUFFIXES; setting it to ".a" on *nix makes >>> FIND_LIBRARY() search for static libraries only. It can be set to >>> its original value at any time to restore the previous behaviour. >>> >>> However, if you know that you're looking exactly for libguide.a and >>> have control over the FIND_LIBRARY() call, i.e. it's not buried in a >>> find module or config file, you should follow Alexander's advice, use >>> the library's full name in FIND_LIBRARY() and pass the latter's result >>> to TARGET_LINK_LIBRARIES(). >>> >>> Regards, >>> >>> Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake