From 635efcd6220cabc258b88c54b1ae4279035bbe31 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Mon, 12 Dec 2022 08:29:54 -0800 Subject: [PATCH] Fixed colcon build not detected on buildfarm --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4acd612..aee50230 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,13 @@ IF(CATKIN_TOPLEVEL OR CATKIN_BUILD_BINARY_PACKAGE OR CATKIN_SKIP_TESTING OR CATK SET(CATKIN_BUILD TRUE) ELSE() # Detect if it is called by colcon (ros2) - string(FIND ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} POS) - IF(${POS} EQUAL -1) - SET(COLCON_BUILD TRUE) + IF(DEFINED AMENT_PREFIX_PATH) # buildfarm + SET(COLCON_BUILD TRUE) + ELSE() # colcon local build in ros2_ws + string(FIND ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} POS) + IF(${POS} EQUAL -1) + SET(COLCON_BUILD TRUE) + ENDIF() ENDIF() ENDIF()