diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c46afc55..7b036a9bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -230,14 +230,10 @@ if(UAGENT_ISOLATED_INSTALL) endif() include(GNUInstallDirs) -set(BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Installation directory for binaries") -set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Installation directory for C headers") -set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation directory for libraries") -set(DATA_INSTALL_DIR ${CMAKE_INSTALL_DATADIR} CACHE PATH "Installation directory for data") if(WIN32) set(LICENSE_INSTALL_DIR . CACHE PATH "Installation directory for licenses") else() - set(LICENSE_INSTALL_DIR ${DATA_INSTALL_DIR}/${PROJECT_NAME} CACHE PATH "Installation directory for licenses") + set(LICENSE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME} CACHE PATH "Installation directory for licenses") endif() ############################################################################### @@ -310,7 +306,7 @@ target_include_directories(${PROJECT_NAME} BEFORE PUBLIC $ $ - $ + $ $ PRIVATE $ @@ -397,11 +393,11 @@ install( EXPORT ${PROJECT_NAME}Targets RUNTIME DESTINATION - ${BIN_INSTALL_DIR} + ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION - ${LIB_INSTALL_DIR} + ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION - ${LIB_INSTALL_DIR} + ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries ) @@ -411,7 +407,7 @@ install( DIRECTORY ${PROJECT_SOURCE_DIR}/include/uxr/agent/ DESTINATION - ${INCLUDE_INSTALL_DIR}/uxr/agent + ${CMAKE_INSTALL_INCLUDEDIR}/uxr/agent FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h" @@ -422,7 +418,7 @@ install( EXPORT ${PROJECT_NAME}Targets DESTINATION - ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake + ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake ) # Install agent exec @@ -433,11 +429,11 @@ if(UAGENT_BUILD_EXECUTABLE) EXPORT MicroXRCEAgentTargets RUNTIME - DESTINATION ${BIN_INSTALL_DIR} + DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY - DESTINATION ${LIB_INSTALL_DIR} + DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE - DESTINATION ${LIB_INSTALL_DIR} + DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT executables ) @@ -453,7 +449,7 @@ install( FILES ${PROJECT_BINARY_DIR}/include/uxr/agent/config.hpp DESTINATION - ${INCLUDE_INSTALL_DIR}/uxr/agent + ${CMAKE_INSTALL_INCLUDEDIR}/uxr/agent ) # Install licenses @@ -473,12 +469,12 @@ configure_package_config_file( ${PROJECT_SOURCE_DIR}/cmake/packaging/Config.cmake.in ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION - ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake + ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake PATH_VARS - BIN_INSTALL_DIR - INCLUDE_INSTALL_DIR - LIB_INSTALL_DIR - DATA_INSTALL_DIR + CMAKE_INSTALL_BINDIR + CMAKE_INSTALL_INCLUDEDIR + CMAKE_INSTALL_LIBDIR + CMAKE_INSTALL_DATADIR ) write_basic_package_version_file( @@ -494,7 +490,7 @@ install( ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}Config.cmake ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}ConfigVersion.cmake DESTINATION - ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake + ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake ) # Install default profile XML. @@ -503,7 +499,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") FILES ${PROJECT_SOURCE_DIR}/agent.refs DESTINATION - ${BIN_INSTALL_DIR} + ${CMAKE_INSTALL_BINDIR} ) endif() @@ -511,15 +507,17 @@ endif() if(EXISTS ${CMAKE_BINARY_DIR}/temp_install/) file(GLOB _deps RELATIVE ${CMAKE_BINARY_DIR}/temp_install ${CMAKE_BINARY_DIR}/temp_install/*) foreach(_d ${_deps}) - install( - DIRECTORY - ${CMAKE_BINARY_DIR}/temp_install/${_d}$,,/> - DESTINATION - ${CMAKE_INSTALL_PREFIX}$,/../,> - COMPONENT - ${_d} - USE_SOURCE_PERMISSIONS - ) + if(UAGENT_ISOLATED_INSTALL) + install( + DIRECTORY + ${CMAKE_BINARY_DIR}/temp_install/${_d}$,,/> + DESTINATION + ${CMAKE_INSTALL_PREFIX}$,/../,> + COMPONENT + ${_d} + USE_SOURCE_PERMISSIONS + ) + endif() endforeach() endif() diff --git a/Dockerfile b/Dockerfile index 4d8e681d8..2caf00656 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,14 +25,14 @@ RUN apt-get install -y gradle RUN apt-get clean # Prepare Micro XRCE-DDS Agent workspace -RUN mkdir -p /agent/build +RUN mkdir -p /agent ADD . /agent/ # Build Micro XRCE-DDS Agent and install -RUN cd /agent/build && \ - cmake -DCMAKE_INSTALL_PREFIX=../install \ - .. &&\ - make -j $(nproc) && make install +RUN cd /agent && \ + cmake -B build && \ + cmake --build build -j $(nproc) && \ + cmake --install build --prefix install # Prepare Micro XRCE-DDS Agent artifacts RUN cd /agent && \ diff --git a/cmake/packaging/Config.cmake.in b/cmake/packaging/Config.cmake.in index cecf44e3e..e2f68fe68 100644 --- a/cmake/packaging/Config.cmake.in +++ b/cmake/packaging/Config.cmake.in @@ -17,11 +17,11 @@ set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@) @PACKAGE_INIT@ if(MSVC OR MSVC_IDE) - set_and_check(@PROJECT_NAME@_BIN_DIR "@PACKAGE_BIN_INSTALL_DIR@") + set_and_check(@PROJECT_NAME@_BIN_DIR "@PACKAGE_CMAKE_INSTALL_BINDIR@") endif() -set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") -set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") -set_and_check(@PROJECT_NAME@_DATA_DIR "@PACKAGE_DATA_INSTALL_DIR@") +set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") +set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@") +set_and_check(@PROJECT_NAME@_DATA_DIR "@PACKAGE_CMAKE_INSTALL_DATADIR@") foreach(d @_deps@) list(GET d 0 _name) diff --git a/cmake/packaging/eProsimaPackaging.cmake b/cmake/packaging/eProsimaPackaging.cmake index a63b8a4f1..7e8133fc5 100644 --- a/cmake/packaging/eProsimaPackaging.cmake +++ b/cmake/packaging/eProsimaPackaging.cmake @@ -41,8 +41,8 @@ if(NOT((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER)) include(CMakePackageConfigHelpers) configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/packaging/Config.cmake.in ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}Config.cmake - INSTALL_DESTINATION ${LIB_INSTALL_DIR}${DIR_EXTENSION}/${PROJECT_NAME}/cmake - PATH_VARS BIN_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}${DIR_EXTENSION}/${PROJECT_NAME}/cmake + PATH_VARS CMAKE_INSTALL_BINDIR CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR ) write_basic_package_version_file(${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}ConfigVersion.cmake VERSION ${PROJECT_VERSION} @@ -50,7 +50,7 @@ if(NOT((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER)) ) install(FILES ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}Config.cmake ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION ${LIB_INSTALL_DIR}${DIR_EXTENSION}/${PROJECT_NAME}/cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}${DIR_EXTENSION}/${PROJECT_NAME}/cmake COMPONENT cmake ) endif() @@ -64,7 +64,7 @@ set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} cmake) if(WIN32) if(EPROSIMA_INSTALLER_MINION) install(FILES ${PROJECT_SOURCE_DIR}/cmake/packaging/windows/${PROJECT_NAME}Config.cmake - DESTINATION ${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/cmake COMPONENT cmake ) endif()