Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add the library to my code after "make install" #128

Open
dottantgal opened this issue May 23, 2016 · 3 comments
Open

How to add the library to my code after "make install" #128

dottantgal opened this issue May 23, 2016 · 3 comments

Comments

@dottantgal
Copy link

dottantgal commented May 23, 2016

Hi, I wanna add the library to my own code, but I don't know how to include it in the Cmakelists file.
It gives me an error "fatal error: serial/serial.h"
This is how my CMakeLists looks like

cmake_minimum_required(VERSION 2.8.3)
project(serial_sensor)

# Set the name to use for the executable.
set (BINNAME serial_sensor)
## Set the source files to use with the executable.
set (SRCS1 ${SRCS1} src/serial_sensor.cpp)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  tf
  message_generation
)

## Generate messages in the 'msg' folder
add_message_files(
  FILES
  Altitude.msg
  Heading.msg
  Pressure.msg
)

## Generate added messages and services with any dependencies listed here
generate_messages(
   DEPENDENCIES
   std_msgs
)

catkin_package(
#  INCLUDE_DIRS include
  LIBRARIES serial
  CATKIN_DEPENDS message_runtime
#  CATKIN_DEPENDS roscpp rospy std_msgs
#  DEPENDS system_lib
)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(include ${catkin_INCLUDE_DIRS})

add_executable(serial_motors src/serial_motors.cpp)
target_link_libraries(serial_motors ${catkin_LIBRARIES})

add_executable (${BINNAME} ${SRCS1})
add_dependencies(${BINNAME} ${PROJECT_NAME}_generate_messages_cpp)
target_link_libraries(${BINNAME} ${catkin_LIBRARIES})

I ve followed the "how to" till the "make install" and this last command gives me
Install the project... -- Install configuration: "" -- Installing: /tmp/usr/local/_setup_util.py -- Installing: /tmp/usr/local/env.sh -- Installing: /tmp/usr/local/setup.bash -- Installing: /tmp/usr/local/setup.sh -- Installing: /tmp/usr/local/setup.zsh -- Installing: /tmp/usr/local/.rosinstall -- Installing: /tmp/usr/local/lib/pkgconfig/serial.pc -- Installing: /tmp/usr/local/share/serial/cmake/serialConfig.cmake -- Installing: /tmp/usr/local/share/serial/cmake/serialConfig-version.cmake -- Installing: /tmp/usr/local/share/serial/package.xml -- Installing: /tmp/usr/local/lib/libserial.so -- Installing: /tmp/usr/local/include/serial/serial.h -- Installing: /tmp/usr/local/include/serial/v8stdint.h
is it strange that it installs under the tmp folder?
Thank you

@wjwwood
Copy link
Owner

wjwwood commented May 23, 2016

You can set the installation directory using the CMAKE_INSTALL_PREFIX. If you're using ROS then your CMakeLists.txt above looks ok. If you're using ROS and Ubuntu, you can just install my package as sudo apt-get install ros-indigo-serial (you can replace indigo with whatever ROS distro you are using). There is also an issue where I describe how you can integrate it into your own CMake project: #52 (comment)

@LivioBrunner4
Copy link

According to https://packages.ubuntu.com/ the mentioned package: "ros-indigo-serial" (as well as ros-melodic-serial) does not exist.
Is it only me, who does not find the package?

@romainreignier
Copy link

Le packages with the prefix ros-<ros_distro>- are not available in the official Ubuntu repositories but in the ROS repositories that you must manually setup according to this page: https://wiki.ros.org/melodic/Installation/Ubuntu
You only need the 1.1, 1.2 and 1.3 steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants