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.

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 ***

OS: Ubuntu 11.10 64 bit
Compiler: g++ 4.6.1.
Cmake 2.8.5


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
)

target_link_libraries(${lib_name}
debug ${do_scoring_debug}
optimized ${do_scoring}
general ${spinx}
general rt
general dl
general pthread
general cblas
general ${atlas}
)


Thank you in advance, Vyacheslav.
--

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

Reply via email to