From 44290ceca3e163a163e302eec411b060ecc08789 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Wed, 30 May 2018 11:42:29 -0700 Subject: [PATCH] add separate option CATKIN_INSTALL_INTO_PREFIX_ROOT --- cmake/all.cmake | 12 +++++++++++- cmake/catkin_generate_environment.cmake | 8 ++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cmake/all.cmake b/cmake/all.cmake index f1bd02134..b3c4f9aea 100644 --- a/cmake/all.cmake +++ b/cmake/all.cmake @@ -70,6 +70,16 @@ if(_index EQUAL -1) list(INSERT CMAKE_PREFIX_PATH 0 ${CATKIN_DEVEL_PREFIX}) endif() +# set CATKIN_INSTALL_INTO_PREFIX_ROOT based on CATKIN_BUILD_BINARY_PACKAGE +# if not defined already +if(NOT DEFINED CATKIN_INSTALL_INTO_PREFIX_ROOT) + if(CATKIN_BUILD_BINARY_PACKAGE) + set(CATKIN_INSTALL_INTO_PREFIX_ROOT FALSE) + else() + set(CATKIN_INSTALL_INTO_PREFIX_ROOT TRUE) + endif() +endif() + # enable all new policies (if available) macro(_set_cmake_policy_to_new_if_available policy) @@ -194,7 +204,7 @@ configure_file(${catkin_EXTRAS_DIR}/templates/env.${script_ext}.in set(CATKIN_ENV ${SETUP_DIR}/env_cached.${script_ext} CACHE INTERNAL "catkin environment") # add additional environment hooks -if(CATKIN_BUILD_BINARY_PACKAGE) +if(NOT CATKIN_INSTALL_INTO_PREFIX_ROOT) set(catkin_skip_install_env_hooks "SKIP_INSTALL") endif() if(CMAKE_HOST_UNIX AND PROJECT_NAME STREQUAL "catkin") diff --git a/cmake/catkin_generate_environment.cmake b/cmake/catkin_generate_environment.cmake index 912078b6e..5e8871dba 100644 --- a/cmake/catkin_generate_environment.cmake +++ b/cmake/catkin_generate_environment.cmake @@ -74,7 +74,7 @@ function(catkin_generate_environment) # installspace set(SETUP_DIR ${CMAKE_INSTALL_PREFIX}) - if(NOT CATKIN_BUILD_BINARY_PACKAGE) + if(CATKIN_INSTALL_INTO_PREFIX_ROOT) # install empty workspace marker if it doesn't already exist install(CODE " if (NOT EXISTS \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\") @@ -99,7 +99,7 @@ function(catkin_generate_environment) configure_file(${catkin_EXTRAS_DIR}/templates/env.sh.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/env.sh @ONLY) - if(NOT CATKIN_BUILD_BINARY_PACKAGE) + if(CATKIN_INSTALL_INTO_PREFIX_ROOT) install(PROGRAMS ${CMAKE_BINARY_DIR}/catkin_generated/installspace/env.sh DESTINATION ${CMAKE_INSTALL_PREFIX}) @@ -109,7 +109,7 @@ function(catkin_generate_environment) configure_file(${catkin_EXTRAS_DIR}/templates/setup.${shell}.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/setup.${shell} @ONLY) - if(NOT CATKIN_BUILD_BINARY_PACKAGE) + if(CATKIN_INSTALL_INTO_PREFIX_ROOT) install(FILES ${CMAKE_BINARY_DIR}/catkin_generated/installspace/setup.${shell} DESTINATION ${CMAKE_INSTALL_PREFIX}) @@ -138,7 +138,7 @@ function(catkin_generate_environment) configure_file(${catkin_EXTRAS_DIR}/templates/rosinstall.in ${CMAKE_BINARY_DIR}/catkin_generated/installspace/.rosinstall @ONLY) - if(NOT CATKIN_BUILD_BINARY_PACKAGE) + if(CATKIN_INSTALL_INTO_PREFIX_ROOT) install(FILES ${CMAKE_BINARY_DIR}/catkin_generated/installspace/.rosinstall DESTINATION ${CMAKE_INSTALL_PREFIX})