From: Nick Brown Date: Wed, 15 Sep 2021 13:25:40 +0000 (+0100) Subject: build: use GNUInstallDirs install destinations X-Git-Tag: v22.02-rc0~23 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=e3cf4d0cf;hp=8b997772633f33528ca4f0b702e93dcfc1c24395;p=vpp.git build: use GNUInstallDirs install destinations So as to be compliant with distribution layouts, as recommend by: https://cmake.org/cmake/help/latest/command/install.html#installing-files Type: make Change-Id: Ic46ace4f26aab1aa4902cbd013c40a92c480680d Signed-off-by: Nick Brown --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 49ea0373eb4..a957d864fad 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,6 +35,7 @@ endif() include(CheckCCompilerFlag) include(CheckIPOSupported) +include(GNUInstallDirs) include(cmake/misc.cmake) include(cmake/cpu.cmake) include(cmake/ccache.cmake) @@ -67,8 +68,8 @@ set(CMAKE_C_COMPILER_TARGET ${CMAKE_SYSTEM_PROCESSOR}-linux-gnu) ############################################################################## check_c_compiler_flag("-Wno-address-of-packed-member" compiler_flag_no_address_of_packed_member) -set(VPP_RUNTIME_DIR "bin" CACHE STRING "Relative runtime directory path") -set(VPP_LIBRARY_DIR "lib" CACHE STRING "Relative library directory path") +set(VPP_RUNTIME_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "Relative runtime directory path") +set(VPP_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "Relative library directory path") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${VPP_RUNTIME_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${VPP_LIBRARY_DIR}) diff --git a/src/vat/CMakeLists.txt b/src/vat/CMakeLists.txt index ee53386f114..66ea69b8da4 100644 --- a/src/vat/CMakeLists.txt +++ b/src/vat/CMakeLists.txt @@ -58,7 +58,7 @@ add_vpp_executable(vpp_json_test ENABLE_EXPORTS NO_INSTALL ############################################################################## install( FILES vat.h json_format.h - DESTINATION include/vat + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vat COMPONENT vpp-dev ) diff --git a/src/vat2/CMakeLists.txt b/src/vat2/CMakeLists.txt index 2afb95e6920..9ee2d8211eb 100644 --- a/src/vat2/CMakeLists.txt +++ b/src/vat2/CMakeLists.txt @@ -98,6 +98,6 @@ install( FILES jsonconvert.h vat2_helpers.h - DESTINATION include/vat2 + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vat2 COMPONENT vpp-dev ) diff --git a/src/vlib/CMakeLists.txt b/src/vlib/CMakeLists.txt index c8127fbe337..df51b2e99eb 100644 --- a/src/vlib/CMakeLists.txt +++ b/src/vlib/CMakeLists.txt @@ -41,7 +41,7 @@ configure_file( ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h - DESTINATION include/vlib + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vlib COMPONENT vpp-dev ) diff --git a/src/vlibapi/CMakeLists.txt b/src/vlibapi/CMakeLists.txt index dfd6b5b5045..e6937a6db01 100644 --- a/src/vlibapi/CMakeLists.txt +++ b/src/vlibapi/CMakeLists.txt @@ -20,7 +20,7 @@ install( api_types.h DESTINATION - include/vlibapi + ${CMAKE_INSTALL_INCLUDEDIR}/vlibapi COMPONENT vpp-dev ) diff --git a/src/vpp-api/vapi/CMakeLists.txt b/src/vpp-api/vapi/CMakeLists.txt index 53034bd27b8..df5d6114333 100644 --- a/src/vpp-api/vapi/CMakeLists.txt +++ b/src/vpp-api/vapi/CMakeLists.txt @@ -34,7 +34,7 @@ install( vapi.hpp vapi_internal.h DESTINATION - include/vapi + ${CMAKE_INSTALL_INCLUDEDIR}/vapi COMPONENT vpp-dev ) diff --git a/src/vpp/CMakeLists.txt b/src/vpp/CMakeLists.txt index 3b466599ffa..e15037cccb7 100644 --- a/src/vpp/CMakeLists.txt +++ b/src/vpp/CMakeLists.txt @@ -51,7 +51,7 @@ foreach(file ${VPP_API_FILES}) FILES ${CMAKE_CURRENT_BINARY_DIR}/${file}.h ${CMAKE_CURRENT_BINARY_DIR}/${file}_enum.h ${CMAKE_CURRENT_BINARY_DIR}/${file}_types.h - DESTINATION include/vpp/${dir} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vpp/${dir} COMPONENT vpp-dev ) endforeach() @@ -133,8 +133,8 @@ add_vpp_library(vppmem_preload LINK_LIBRARIES vppinfra ) -install(FILES conf/startup.conf DESTINATION etc/vpp COMPONENT vpp) -install(FILES conf/80-vpp.conf DESTINATION etc/sysctl.d COMPONENT vpp) +install(FILES conf/startup.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/vpp COMPONENT vpp) +install(FILES conf/80-vpp.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/sysctl.d COMPONENT vpp) ############################################################################## # VAT2 plugins diff --git a/src/vppinfra/CMakeLists.txt b/src/vppinfra/CMakeLists.txt index 8114ea19ea4..4be291e1e8d 100644 --- a/src/vppinfra/CMakeLists.txt +++ b/src/vppinfra/CMakeLists.txt @@ -32,7 +32,7 @@ configure_file( install( FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h - DESTINATION include/vppinfra + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vppinfra COMPONENT vpp-dev )