[CMake] linking with .so w/ non-standard names
Bill Hoffman
bill.hoffman at kitware.com
Fri Aug 14 20:40:18 EDT 2009
Kenneth Chang wrote:
> I manufactured a simple setup to demonstrate what I have. I hope this
> helps.
>
...
Is /home/kchang/sandbox/thost/thostmduserapi.so a valid object? I was
able to reproduce what you had if I did this:
cmake_minimum_required(VERSION 2.6.4)
add_executable(foo foo.c)
target_link_libraries(foo /home/hoffman/foo/foo.so)
If I copied a valid .so from /usr/lib
cp /usr/lib/libmpi.so ../foo.so
I get this:
/usr/bin/gcc -o CMakeFiles/foo.dir/foo.c.o -c /home/hoffman/foo/foo.c
Linking C executable foo
/home/hoffman/CMake26-build/bin/cmake -E cmake_link_script
CMakeFiles/foo.dir/link.txt --verbose=1
/usr/bin/gcc -fPIC CMakeFiles/foo.dir/foo.c.o -o foo -rdynamic
../foo.so -Wl,-rpath,/home/hoffman/foo
make[2]: Leaving directory `/home/hoffman/foo/b'
If I remove the file and create a bogus one:
rm ../foo.so
touch ../foo.so
Then I get the split:
make[2]: Leaving directory `/home/hoffman/foo/b'
make -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/build
make[2]: Entering directory `/home/hoffman/foo/b'
Linking C executable foo
/home/hoffman/CMake26-build/bin/cmake -E cmake_link_script
CMakeFiles/foo.dir/link.txt --verbose=1
/usr/bin/gcc -fPIC CMakeFiles/foo.dir/foo.c.o -o foo -rdynamic
-L/home/hoffman/foo -lfoo -Wl,-rpath,/home/hoffman/foo
/home/hoffman/foo/libfoo.so: file not recognized: File truncated
-Bill
More information about the CMake
mailing list