I manufactured a simple setup to demonstrate what I have. I hope this helps.

Thanks,
Kenny

CMakeLists.txt
~~~~~~~~~~
CMAKE_MINIMUM_REQUIRED( VERSION 2.6.4 )

ADD_EXECUTABLE( main
 main.cc
)

SET( CMAKE_SHARED_LIBRARY_PREFIX_bak ${CMAKE_SHARED_LIBRARY_PREFIX} )
SET( CMAKE_SHARED_LIBRARY_PREFIX )
FIND_LIBRARY( THOST_LIBRARY thostmduserapi.so
 PATHS /home/kchang/sandbox/thost )
SET( CMAKE_SHARED_LIBRARY_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX_bak} )

MESSAGE( STATUS "DEBUG: THOST_LIBRARY = ${THOST_LIBRARY}" )

TARGET_LINK_LIBRARIES( main
 ${THOST_LIBRARY}
)


output
~~~~~
kch...@fiji:~/sandbox/thost$ rm -rf CMakeCache.txt

kch...@fiji:~/sandbox/thost$ ../cmake-2.6.4/bin/cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- DEBUG: THOST_LIBRARY = /home/kchang/sandbox/thost/thostmduserapi.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kchang/sandbox/thost

kch...@fiji:~/sandbox/thost$ make VERBOSE=1
/home/kchang/sandbox/cmake-2.6.4/bin/cmake -H/home/kchang/sandbox/thost -B/home/kchang/sandbox/thost --check-build-system CMakeFiles/Makefile.cmake 0 /home/kchang/sandbox/cmake-2.6.4/bin/cmake -E cmake_progress_start /home/kchang/sandbox/thost/CMakeFiles /home/kchang/sandbox/thost/CMakeFiles/progress.make
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/local/home/kchang/sandbox/thost'
make -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/depend
make[2]: Entering directory `/local/home/kchang/sandbox/thost'
cd /home/kchang/sandbox/thost && /home/kchang/sandbox/cmake-2.6.4/bin/cmake -E cmake_depends "Unix Makefiles" /home/kchang/sandbox/thost /home/kchang/sandbox/thost /home/kchang/sandbox/thost /home/kchang/sandbox/thost /home/kchang/sandbox/thost/CMakeFiles/main.dir/DependInfo.cmake --color= Dependee "/home/kchang/sandbox/thost/CMakeFiles/main.dir/DependInfo.cmake" is newer than depender "/home/kchang/sandbox/thost/CMakeFiles/main.dir/depend.internal".
Scanning dependencies of target main
make[2]: Leaving directory `/local/home/kchang/sandbox/thost'
make -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/build
make[2]: Entering directory `/local/home/kchang/sandbox/thost'
/home/kchang/sandbox/cmake-2.6.4/bin/cmake -E cmake_progress_report /home/kchang/sandbox/thost/CMakeFiles 1
[100%] Building CXX object CMakeFiles/main.dir/main.cc.o
/usr/bin/c++ -o CMakeFiles/main.dir/main.cc.o -c /home/kchang/sandbox/thost/main.cc
Linking CXX executable main
/home/kchang/sandbox/cmake-2.6.4/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1 /usr/bin/c++ -fPIC CMakeFiles/main.dir/main.cc.o -o main -rdynamic -L/home/kchang/sandbox/thost -lthostmduserapi -Wl,-rpath,/home/kchang/sandbox/thost
/usr/bin/ld: cannot find -lthostmduserapi
collect2: ld returned 1 exit status
make[2]: *** [main] Error 1
make[2]: Leaving directory `/local/home/kchang/sandbox/thost'
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make[1]: Leaving directory `/local/home/kchang/sandbox/thost'
make: *** [all] Error 2

Bill Hoffman wrote:
Kenneth Chang wrote:
I did, then cmake broke the .so down into its component paths and library name, and used -L<path> -l<libname>, which caused the linker to look for <path>/lib<libname>.so


It should not do that in 2.6.4, it should use the full path.... Do you have any policy warnings, or do you have the cmake minimum version set to something very old?

-Bill

_______________________________________________
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