On 14 December 2012 13:32, Rolf Eike Beer <e...@sf-mail.de> wrote: > Am , schrieb Witold E Wolski: >> >> Hi, >> >> I am using >> >> FIND_LIBRARY(CPPUNIT_LIBRARY NAMES cppunit HINTS >> ${CPPUNIT_INCLUDE_DIR}/../lib) >> >> >> to find library locations. But what I am needing is the directory >> containing the lib and not the full path. >> How do I get it? > > > cmake --help-command get_filename_component > > And if you think about using that for linking: all you need is the full > path. Just pass that to target_link_libraries. Don't even think about > messing around with link_directories().
Indeed and this should be well explained in the documentation. I've met countless cases and users who are confused [1] about file path vs folder path returned from the find_library and related commands. Many, if not most those new to CMake still think along the configuration of Visual Studio project with separate properties for library folder and library names. [1] http://www.cmake.org/pipermail/cmake/2012-December/052909.html Best regards, -- Mateusz Loskot, http://mateusz.loskot.net -- 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