Makefile to CMakeLists.txt (ROS, Eclipse)
Hello there,
I'm using a developement board that has its own libraries. I have installed ROS on it and now I need to use publish/subscribe by including its libraries to the CMakeLists.txt of the package. I have to also note that I use Eclipse for compilation, so the CMakeLists.txt is in that form. Here is the Makefile of hardware library that I want to use in CMakeLists.txt:
DIR=$(shell pwd)/../
INCS = -I.\
-I$(DIR) \
-I$(DIR)/hardware \
-I$(DIR)/hardware/environment \
-I$(DIR)/hardware/environment/cores \
-I$(DIR)/hardware/environment/cores/environment \
-I$(DIR)/hardware/environment/variants \
-I$(DIR)/hardware/environment/variants/sunxi \
-I$(DIR)/libraries \
-I$(DIR)/libraries/Serial \
-I$(DIR)/libraries/SPI \
-I$(DIR)/libraries/Wire \
-I$(DIR)/libraries/LiquidCrystal \
-I$(DIR)/Basibos/include
LIBS=../libenvironment.a
TARGET=../output/test
OBJS = BasibosAnaProgram
all:
@mkdir -p $(TARGET)
for i in $(OBJS); do echo "$(CXX) $(INCS) $$i.cpp -o $(TARGET)/$$i $(LIBS)"; done
@for i in $(OBJS); do $(CXX) $(INCS) $$i.cpp -o $(TARGET)/$$i $(LIBS); done
clean:
@for i in $(OBJS); do rm -f $(TARGET)/$$i; done
And here is the example CMakeLists.txt that Makefile should be included:
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
rosbuild_init()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
rosbuild_add_library(${PROJECT_NAME} src/Basibos.cpp)
rosbuild_add_library(${PROJECT_NAME} src/HedefeGitme.cpp)
rosbuild_add_library(${PROJECT_NAME} src/Konum.cpp)
rosbuild_add_library(${PROJECT_NAME} src/Robot.cpp)
rosbuild_add_library(${PROJECT_NAME} src/Sonar.cpp)
rosbuild_add_library(${PROJECT_NAME} src/Zaman.cpp)
rosbuild_add_library(${PROJECT_NAME} src/XMLAyiklayici.cpp)
rosbuild_add_executable(srctest RobotKontrol.cpp)
target_link_libraries(srctest ${PROJECT_NAME})
I'm stuck and can't go forward without help. Any help will be greately appreciated. Thanks in advance
1) remove the duplicate question here http://answers.ros.org/question/70966/makefile-to-cmakeliststxt-ros-and-eclipse/ 2)see answer