From 437da0a3d928e8b17f8ecae758b159f97acf3b19 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Tue, 17 Oct 2017 00:55:08 +0200 Subject: [PATCH] Use CMake's ${CMAKE_INSTALL_LIBDIR} variable to decide where to place the built libraries The typical situation where the usual, plain 'lib' is not wanted is in a multiarch system, that allows installation of the same library built for multiple architectures. Use the standard ${CMAKE_INSTALL_LIBDIR} variable (coming from the GNUInstallDirs module) to figure where to put the built libraries. Signed-off-by: Mattia Rizzolo --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47de63f529..62a8cd59f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -415,7 +415,8 @@ else() ocv_update(OPENCV_OTHER_INSTALL_PATH etc) ocv_update(OPENCV_CONFIG_INSTALL_PATH ".") else() - ocv_update(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX}) + include(GNUInstallDirs) + ocv_update(OPENCV_LIB_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}) ocv_update(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}) ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples) ocv_update(OPENCV_JAR_INSTALL_PATH share/OpenCV/java) @@ -424,7 +425,7 @@ else() if(NOT DEFINED OPENCV_CONFIG_INSTALL_PATH) math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}") if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX) - ocv_update(OPENCV_CONFIG_INSTALL_PATH lib${LIB_SUFFIX}/cmake/opencv) + ocv_update(OPENCV_CONFIG_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/opencv) else() ocv_update(OPENCV_CONFIG_INSTALL_PATH share/OpenCV) endif()