From a6121e1655b156496fa1905846013d86d9705bbc Mon Sep 17 00:00:00 2001 From: TSC21 Date: Wed, 12 Dec 2018 18:30:07 +0000 Subject: [PATCH] Cmake build: do not change CMAKE_RUNTIME_OUTPUT_DIRECTORY if building with catkin --- CMakeLists.txt | 7 ++++++- platforms/posix/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d65c12315..aa5dc10184 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,7 +260,12 @@ set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # For the catkin build process, unset build of dynamically-linked binaries -if (CATKIN_DEVEL_PREFIX) +# and do not change CMAKE_RUNTIME_OUTPUT_DIRECTORY +if (NOT CATKIN_DEVEL_PREFIX) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PX4_BINARY_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PX4_BINARY_DIR}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PX4_BINARY_DIR}) +else() SET(BUILD_SHARED_LIBS OFF) endif() diff --git a/platforms/posix/CMakeLists.txt b/platforms/posix/CMakeLists.txt index 6784612ee8..3c94cd1d27 100644 --- a/platforms/posix/CMakeLists.txt +++ b/platforms/posix/CMakeLists.txt @@ -5,6 +5,12 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES) +# When building with catkin, do not change CMAKE_RUNTIME_OUTPUT_DIR from +# CMAKE_CURRENT_BINARY_DIR ''./platforms/posix' to './bin' +if (NOT CATKIN_DEVEL_PREFIX) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +endif() + set(PX4_SHELL_COMMAND_PREFIX "px4-") add_definitions("-DPX4_SHELL_COMMAND_PREFIX=\"${PX4_SHELL_COMMAND_PREFIX}\"")