cmake: Allow override of install directories
authorHauke Mehrtens <hmehrtens@maxlinear.com>
Tue, 5 Oct 2021 16:54:39 +0000 (18:54 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Fri, 22 Oct 2021 20:58:18 +0000 (22:58 +0200)
Use the GNUInstallDirs include to allow callers to override the install
directories. This is helpful when building uci in build systems like
Yocto which prefer to use /usr/lib64 for the 64 bit libraries.

Signed-off-by: Hauke Mehrtens <hmehrtens@maxlinear.com>
CMakeLists.txt

index 560ed6597adcba3844c2f69ac922aacfa733f46a..50e7f51fe5fafa9052c125d54443a8b31599efb6 100644 (file)
@@ -1,4 +1,5 @@
 cmake_minimum_required(VERSION 2.6)
+INCLUDE(GNUInstallDirs)
 
 PROJECT(uci C)
 
@@ -74,12 +75,12 @@ IF(UNIT_TESTING)
 ENDIF()
 
 INSTALL(FILES uci.h uci_config.h uci_blob.h ucimap.h
-       DESTINATION include
+       DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
 )
 
 INSTALL(TARGETS uci cli
-       ARCHIVE DESTINATION lib
-       LIBRARY DESTINATION lib
-       RUNTIME DESTINATION bin
+       ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+       LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+       RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
 )