0
$\begingroup$

Gazebo Answers logo

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


Originally posted by debz on Gazebo Answers with karma: 198 on 2015-12-09

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

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)

Originally posted by nkoenig with karma: 7676 on 2015-12-09

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by debz on 2015-12-11:
Sweet, thx.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.