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 -0500

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 -0500

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 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 159 times

Last updated: Jul 27 '17