aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-07-18 10:13:49 +0200
committerMauro Sardara <msardara@cisco.com>2019-07-18 10:45:08 +0200
commit64442da40c3e390649d42e3e97a74986bba27afd (patch)
tree35e265c654c01822bc398ed16b8108509d9a28c0 /cmake
parent87cd4b4d22a08f1b56cd067770a29bcb05ebb845 (diff)
[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 <msardara@cisco.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/BuildMacros.cmake21
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()