Hey Yesterday I figured out how to use target_link_libraries to add libraries, but only one library at the time. A great thanks to Brian's CMake style approach, just what I seeked, also thanks to Rich for the links, nice with additional information of the use of CMake. Regards Sebastian On 15 February 2011 05:11, Rich Mattes wrote: > On 02/14/2011 09:01 PM, Brian Gerkey wrote: > > On Sun, Feb 13, 2011 at 11:46 AM, Aslund > wrote: > >> While an option is to use the ROS Player driver, then I want to avoid > it. I > >> have already Player installed on my robot and had quite some problems > with > >> it, which is now solved, but it scared me from doing any changes to it, > so I > >> want to maintain the robot as it is. > >> My idea is to have a second computer to process the algorithms, which > >> communicates through Player on a local network to my robot. > >> I used the Publisher example from the tutorial to create a base to work > >> with, if I add the following lines to my CMakeLists.txt: > >> > >> include_directories(/usr/local/include/player-3.1) > >> link_directories(/usr/local/lib) > >> > >> then I am able to compile the example including the header file of > Player ( > >> #include "libplayerc++/playerc++.h" ), but when I add Player functions, > then > >> rosmake returns that there are undefined references, which could > indicate > >> that I need a way of adding the library files into my CMakeLists.txt > list. > >> My problem is that I do not know how to add .so-library files into > >> CMakeLists.txt inorder to make the compiler able to use Player > functions, I > >> hope someone can help me resolving this problem. > > I would use pkg-config to get the build flags for Player. Assuming > > that you're trying to build a client program against libplayerc++, do > > something like: > > > > include(FindPkgConfig) > > pkg_check_modules(PLAYERCPP REQUIRED playerc++) > > include_directories(${PLAYERCPP_INCLUDE_DIRS}) > > link_directories(${PLAYERCPP_LIBRARY_DIRS}) > > # Assuming that you're building an executable named foo > > target_link_libraries(foo ${PLAYERCPP_LIBRARIES}) > > > > Note that you may have to add /usr/local/lib/pkgconfig to your > PKG_CONFIG_PATH. > > > > brian. > > > > If you're using cmake, you may also find the following helpful: > > http://playerstage.sourceforge.net/wiki/Player_and_CMake > > http://playerstage.sourceforge.net/wiki/Compiling_Player_3_clients_and_plugins > > Rich > > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users >