Hi, On Mon, Apr 23, 2012 at 13:24, Vyacheslav Karamov <ubuntul...@yandex.ru>wrote:
> Hi All! > > I have a problem with target_link_libraries. It can't link with shared > libraries not from directory listed in LD_LIBRARY_PATH. > 1. When I try to link shared library with the full path obtained from > find_library, my library is passed to gcc without -l option as ordinary > object file. > What is the problem with linking the absolute path of the shared library? This should just work > 2. When I try to link by specifying short name "cblas" I've got the error > message: > > Linking CXX shared library ../../sndcompare/amd64sse3/**libsndcompared.so > /usr/bin/ld: cannot find -lcblas > collect2: ld returned 1 exit status > make[2]: *** [../../sndcompare/amd64sse3/**libsndcompared.so] Error 1 > make[1]: *** [CMakeFiles/sndcompare.dir/**all] Error 2 > make: *** [all] Error 2 > *** Failed *** > This is because the linker does not know the directory where to search for the library. > add_library(${lib_name} SHARED > ${io_files} > ${utils_files} > ${tech_independ_files} > ${other_files} > ) > > find_library(atlas > NAME atlas > PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${**CMAKE_SYSTEM_NAME}/atlas/${** > arch}/lib > DOC "Atlas library" > ) > > find_library(cblas > NAME cblas > PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${**CMAKE_SYSTEM_NAME}/atlas/${** > arch}/lib > DOC "Cblas library" > ) > > link_directories( > ${CMAKE_CURRENT_SOURCE_DIR}/${**CMAKE_SYSTEM_NAME}/atlas/${**arch}/lib > ${CMAKE_CURRENT_SOURCE_DIR}/..**/../Sphinx/sphinxbase/${CMAKE_** > SYSTEM_NAME}/${arch}/lib > ) > link_directories is not needed at all here or should not be needed. Just make sure to pass ${cblas} and ${atlas} to target_link_libraries. If that produces errors please provide the exact error message. Andreas
-- 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