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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 64 times

Last updated: Jul 27 '17