Home | Tutorials | Wiki | Issues
Ask Your Question
1

CMakeLists for plugin compilation

asked 2015-12-09 12:26:32 -0600

debz gravatar image

Hello,

I don't relly know how to use CMAKE. I would like to add some more .cc files to compile a model or world plugin for gazebo. Until now, I took the CMakLists.txt file given in the tutorial to compile (with commands "cmake ../" and "make"). I added codes to my plugin by including them as .hh file. But the code starts being pretty big and it takes 30 seconds to compile everytime I make a modification. So does anyone knows how I can modify the CMakeListst.txt file to add some other .cc files ? Here is the my actual one:


cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

find_package(Boost REQUIRED COMPONENTS system)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})

include (FindPkgConfig)
if (PKG_CONFIG_FOUND)
  pkg_check_modules(GAZEBO gazebo)
endif()
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x")

add_library(arm_control SHARED arm_control.cc)
target_link_libraries(arm_control ${GAZEBO_LIBRARIES} ${Boost_LIBRARIES})

Cheers

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-12-09 16:57:05 -0600

nkoenig gravatar image

Change this line:

add_library(arm_control SHARED arm_control.cc)

to

add_library(arm_control SHARED arm_control.cc MY_NEW_SOURCE_FILE.cc MY_THIRD_SOURCE_FILE.cc)
edit flag offensive delete link more

Comments

Sweet, thx.

debz gravatar imagedebz ( 2015-12-11 07:26:40 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-12-09 12:26:32 -0600

Seen: 89 times

Last updated: Dec 09 '15