diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-07-18 11:17:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-07-18 11:17:00 +0000 |
commit | 5ca4abd6766b75a56172dd71b2ad604fe4c7ff7d (patch) | |
tree | 95f08346a82d97f393af5ae27f52ccf1929e6c0a /cmake/Modules | |
parent | ac16674af88636b6016cd90d15d7f6887a1c8b19 (diff) | |
parent | 64442da40c3e390649d42e3e97a74986bba27afd (diff) |
Merge "[HICN-248] Install libraries under correct folder (lib/x86_64-linux-gnu on ubuntu/debian and lib64 on centos)"
Diffstat (limited to 'cmake/Modules')
-rw-r--r-- | cmake/Modules/BuildMacros.cmake | 21 |
1 files changed, 14 insertions, 7 deletions
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() |