summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/Modules/BuildMacros.cmake21
-rw-r--r--hicn-plugin/CMakeLists.txt8
-rw-r--r--libtransport/src/hicn/transport/CMakeLists.txt4
-rw-r--r--libtransport/src/hicn/transport/protocols/CMakeLists.txt2
4 files changed, 23 insertions, 12 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()
diff --git a/hicn-plugin/CMakeLists.txt b/hicn-plugin/CMakeLists.txt
index be71b36a3..8c859cdd9 100644
--- a/hicn-plugin/CMakeLists.txt
+++ b/hicn-plugin/CMakeLists.txt
@@ -14,6 +14,8 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(hicn-plugin)
+include(GNUInstallDirs)
+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/"
@@ -195,7 +197,7 @@ if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif (NOT CMAKE_BUILD_TYPE)
-SET(HICN_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib CACHE STRING "hicn_install_prefix")
+SET(HICN_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} CACHE STRING "hicn_install_prefix")
if (CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -march=native -O3 -g")
@@ -274,9 +276,9 @@ install(TARGETS hicn_api_test_plugin
COMPONENT ${HICN_PLUGIN})
install(FILES ${HICN_API_TEST_HEADER_FILES} ${HICN_API_GENERATED_FILES}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/vpp_plugins/hicn
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/vpp_plugins/hicn
COMPONENT ${HICN_PLUGIN})
install(FILES ${HICN_VAPI_GENERATED_FILES}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/vapi
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/vapi
COMPONENT ${HICN_PLUGIN})
diff --git a/libtransport/src/hicn/transport/CMakeLists.txt b/libtransport/src/hicn/transport/CMakeLists.txt
index b6be3f77a..3b5e9a15f 100644
--- a/libtransport/src/hicn/transport/CMakeLists.txt
+++ b/libtransport/src/hicn/transport/CMakeLists.txt
@@ -13,6 +13,8 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
+include(GNUInstallDirs)
+
set(ASIO_STANDALONE 1)
add_subdirectory(core)
@@ -26,7 +28,7 @@ add_subdirectory(utils)
configure_file("config.h.in" "config.h" @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h
- DESTINATION include/hicn/transport
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hicn/transport
COMPONENT lib${LIBTRANSPORT}-dev
)
diff --git a/libtransport/src/hicn/transport/protocols/CMakeLists.txt b/libtransport/src/hicn/transport/protocols/CMakeLists.txt
index 84a4d5279..23aeca9bf 100644
--- a/libtransport/src/hicn/transport/protocols/CMakeLists.txt
+++ b/libtransport/src/hicn/transport/protocols/CMakeLists.txt
@@ -57,7 +57,7 @@ set(TRANSPORT_CONFIG
install(
FILES ${TRANSPORT_CONFIG}
- DESTINATION etc/hicn
+ DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/hicn
COMPONENT lib${LIBTRANSPORT}
)