From 64442da40c3e390649d42e3e97a74986bba27afd Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Thu, 18 Jul 2019 10:13:49 +0200 Subject: [HICN-248] Install libraries under correct folder (lib/x86_64-linux-gnu on ubuntu/debian and lib64 on centos) Change-Id: I9c8fc206f2f93b9eae1060387ab6d0833da80124 Signed-off-by: Mauro Sardara --- cmake/Modules/BuildMacros.cmake | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'cmake/Modules') diff --git a/cmake/Modules/BuildMacros.cmake b/cmake/Modules/BuildMacros.cmake index e7244d2bc..3e681b425 100644 --- a/cmake/Modules/BuildMacros.cmake +++ b/cmake/Modules/BuildMacros.cmake @@ -15,6 +15,8 @@ # Utils for building libraries and executables # +include(GNUInstallDirs) + macro(build_executable exec) cmake_parse_arguments(ARG "NO_INSTALL" @@ -29,7 +31,7 @@ macro(build_executable exec) set_target_properties(${exec} PROPERTIES - INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" INSTALL_RPATH_USE_LINK_PATH TRUE ARCHIVE_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" LIBRARY_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" @@ -56,7 +58,12 @@ macro(build_executable exec) endif() if(NOT ARG_NO_INSTALL) - install(TARGETS ${exec} RUNTIME DESTINATION bin COMPONENT ${ARG_COMPONENT}) + install( + TARGETS ${exec} + RUNTIME + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT ${ARG_COMPONENT} + ) endif() endmacro() @@ -99,7 +106,7 @@ macro(build_library lib) set_target_properties(${library} PROPERTIES - INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" + INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" INSTALL_RPATH_USE_LINK_PATH TRUE ARCHIVE_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" LIBRARY_OUTPUT_DIRECTORY "${BUILD_ROOT}/lib" @@ -138,9 +145,9 @@ macro(build_library lib) install( TARGETS ${library} - RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${ARG_COMPONENT} ) @@ -173,7 +180,7 @@ macro(build_library lib) endif() install( FILES ${file} - DESTINATION include/${ARG_INSTALL_ROOT_DIR}/${dir} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${ARG_INSTALL_ROOT_DIR}/${dir} COMPONENT ${COMPONENT} ) endforeach() -- cgit 1.2.3-korg