ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How could I detect that ROS is installed in CMakeLists

asked 2017-07-27 22:23:07 -0600

Rr gravatar image

Hi!

I need to make universal CMakeLists.txt, able to build package with ROS or not. So I need some conditional variable to detect, that package could be build with ROS:

if(SOMEVAR)
   set(USE_ROS true)
endif()

if(USE_ROS)
   find_package ...
   catkin_package ...
endif()

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-07-27 22:36:10 -0600

ahendrix gravatar image

find_package creates a _FOUND variable for packages instead of an error if you don't use REQUIRED.

Try:

find_package(catkin COMPONENTS ...)

if( $catkin_FOUND )
    # Build with ROS
endif()
edit flag offensive delete link more

Comments

Possibly related: #q230877.

gvdhoorn gravatar image gvdhoorn  ( 2017-07-28 03:34:24 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-07-27 22:23:07 -0600

Seen: 155 times

Last updated: Jul 27 '17