From b19ea4e04c71faabe57e046a22136b405b0413c1 Mon Sep 17 00:00:00 2001 From: Kenji Brameld Date: Fri, 5 Jul 2024 19:25:35 +0000 Subject: [PATCH 1/4] Revive survive in catkin make build property, for the ability to use catkin_tools to build survive_publisher --- tools/CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 2e137c19..1e397998 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -2,13 +2,16 @@ if(OPENVR_LIBRARIES AND NOT USE_SINGLE_PRECISION) add_subdirectory(openvr_driver) endif() -find_package(catkin QUIET COMPONENTS - roscpp - geometry_msgs) +get_property(survive_in_catkin_make GLOBAL PROPERTY SURVIVE_IN_CATKIN_MAKE) -IF(catkin_DIR) - add_subdirectory(ros_publisher) -ENDIF() +if(NOT survive_in_catkin_make) + find_package(catkin QUIET COMPONENTS + roscpp + geometry_msgs) + IF(catkin_DIR) + add_subdirectory(ros_publisher) + ENDIF() +endif() find_library(XDO_LIB xdo) if(XDO_LIB) From ebb64eff1b600caca2d73bee9891ed685071b9eb Mon Sep 17 00:00:00 2001 From: Kenji Brameld Date: Fri, 5 Jul 2024 20:05:57 +0000 Subject: [PATCH 2/4] cmake_minimum_required version must be set --- tools/ros_publisher/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ros_publisher/CMakeLists.txt b/tools/ros_publisher/CMakeLists.txt index c35237d3..7cbc6ac5 100644 --- a/tools/ros_publisher/CMakeLists.txt +++ b/tools/ros_publisher/CMakeLists.txt @@ -1,4 +1,5 @@ project(survive_publisher) +cmake_minimum_required(VERSION 3.12) add_compile_options(-std=c++14) From 43f20013c567c105213965ef1e3793e5746759ae Mon Sep 17 00:00:00 2001 From: Kenji Brameld Date: Fri, 5 Jul 2024 20:08:13 +0000 Subject: [PATCH 3/4] catkin_package must be called before any targets are added. Otherwise, executables don't get compiled into the devel directory correctly --- tools/ros_publisher/CMakeLists.txt | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/ros_publisher/CMakeLists.txt b/tools/ros_publisher/CMakeLists.txt index 7cbc6ac5..5f4f2a5e 100644 --- a/tools/ros_publisher/CMakeLists.txt +++ b/tools/ros_publisher/CMakeLists.txt @@ -9,7 +9,7 @@ if(NOT TARGET survive) add_subdirectory(../../ survive_build) endif() -find_package(catkin REQUIRED COMPONENTS +find_package(catkin REQUIRED COMPONENTS roscpp geometry_msgs tf ) @@ -17,6 +17,22 @@ find_package(catkin REQUIRED COMPONENTS ## System dependencies are found with CMake's conventions # find_package(Boost REQUIRED COMPONENTS system) +################################### +## catkin specific configuration ## +################################### +## The catkin_package macro generates cmake config files for your package +## Declare things to be passed to dependent projects +## INCLUDE_DIRS: uncomment this if your package contains header files +## LIBRARIES: libraries you create in this project that dependent projects also need +## CATKIN_DEPENDS: catkin_packages dependent projects also need +## DEPENDS: system dependencies of this project that dependent projects also need +catkin_package( +# INCLUDE_DIRS include +# LIBRARIES survive_publisher +# CATKIN_DEPENDS other_catkin_pkg +# DEPENDS system_lib +) + ########### ## Build ## ########### @@ -27,7 +43,7 @@ message( ${catkin_INCLUDE_DIRS} ) include_directories( ${catkin_INCLUDE_DIRS} ../../include - ../../redist + ../../redist ) link_directories(../../lib) @@ -53,22 +69,6 @@ target_link_libraries(${PROJECT_NAME}_node survive ) -################################### -## catkin specific configuration ## -################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if your package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need -catkin_package( -# INCLUDE_DIRS include -# LIBRARIES survive_publisher -# CATKIN_DEPENDS other_catkin_pkg -# DEPENDS system_lib -) - ## Mark executables and/or libraries for installation install(TARGETS ${PROJECT_NAME}_node ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} From 3d8af39ac1cc81fba42bbe1cc1b43fe451e540f5 Mon Sep 17 00:00:00 2001 From: Mike Lanighan Date: Tue, 16 Jul 2024 14:26:25 -0500 Subject: [PATCH 4/4] fix compile options to work with clang --- tools/ros_publisher/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/ros_publisher/CMakeLists.txt b/tools/ros_publisher/CMakeLists.txt index 5f4f2a5e..c293bd8e 100644 --- a/tools/ros_publisher/CMakeLists.txt +++ b/tools/ros_publisher/CMakeLists.txt @@ -1,7 +1,8 @@ project(survive_publisher) cmake_minimum_required(VERSION 3.12) -add_compile_options(-std=c++14) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) if(NOT TARGET survive) message("Adding base cmake...")