On 11.02.09 11:31:18, ankit jain wrote:
> Hi all,
> 
> I have folder f1 having csome cpp files. structure is like this:
> f1
> ....c1.cpp
> ....c2.cpp
> 
> now i create an executable for it as
> add_executable(myexe c1.cpp c2.cpp)
> 
> the path of f1 folder is /home/ankit/mycode/f1
> now i want to link myexe to a library lib.so and lib1.a which are not in
> this folder but resides in other folder suppose in lib whose path is
> something like this:
> 
> /home/ankit/mycode/lib/lib.so
> /home/ankit/mycode/lib/lib1.a
> 
> How to do achieve this linkage so that no unref came.
> Right now iam doing it usinmg target_link_libraries by giving the entire
> path somthing like this:
> 
> target_link_libraries(myexe /home/ankit/mycode/lib/lib.so
> /home/ankit/mycode/lib/lib1.a)
> 
> but it gives some unrefs. i dont know why.

You're doing it correctly, if you still get undefined references you're
missing yet another library. For example lib.so might need you to link to
more libraries if it exposes some of the symbols from those.

For better cross-platform working of your project you should look into
the find_library command to avoid hardcoding the path of the libraries in
your CMakeLists.txt.

Andreas 

-- 
You will remember something that you should not have forgotten.
_______________________________________________
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