Skip to content

Commit 437da0a

Browse files
committed
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 <[email protected]>
1 parent 110af09 commit 437da0a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ else()
415415
ocv_update(OPENCV_OTHER_INSTALL_PATH etc)
416416
ocv_update(OPENCV_CONFIG_INSTALL_PATH ".")
417417
else()
418-
ocv_update(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX})
418+
include(GNUInstallDirs)
419+
ocv_update(OPENCV_LIB_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX})
419420
ocv_update(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH})
420421
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples)
421422
ocv_update(OPENCV_JAR_INSTALL_PATH share/OpenCV/java)
@@ -424,7 +425,7 @@ else()
424425
if(NOT DEFINED OPENCV_CONFIG_INSTALL_PATH)
425426
math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
426427
if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX)
427-
ocv_update(OPENCV_CONFIG_INSTALL_PATH lib${LIB_SUFFIX}/cmake/opencv)
428+
ocv_update(OPENCV_CONFIG_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/opencv)
428429
else()
429430
ocv_update(OPENCV_CONFIG_INSTALL_PATH share/OpenCV)
430431
endif()

0 commit comments

Comments
 (0)