Best way to get distro version in CMakeLists.txt?
I usually do like below to check the rosdistro. Are there better way to do like this?
# check ros distro >= indigo
execute_process(
COMMAND python -c "import sys; sys.exit(ord('$ENV{ROS_DISTRO}'[0]) >= ord('indigo'[0]))"
RESULT_VARIABLE DISTRO_GE_INDIGO
)
if(DISTRO_GE_INDIGO)
...
endif()
I'm not sure whether there is a CMake macro defined anywhere. An alternative to the python one-liner might be to use
rosversion -d
. That returnshydro
,indigo
, etc.