From 5667e7de137340d4dd0a6e3f3ffcdea65d7bddb6 Mon Sep 17 00:00:00 2001 From: Sergiy Kibrik Date: Tue, 13 Oct 2015 23:30:42 +0300 Subject: [PATCH] cmake: use CMAKE_INSTALL_* variables Replace hard-coded installation directories with cmake-provided variables, which gives more flexibility on where to install final binaries. Great simplification for usage with e.g. BitBake recipes. Signed-off-by: Sergiy Kibrik --- CMakeLists.txt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc1e4a5..d749c25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 2.6) PROJECT(procd C) +INCLUDE(GNUInstallDirs) ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") @@ -13,7 +14,7 @@ ENDIF() ADD_LIBRARY(setlbf SHARED service/setlbf.c) INSTALL(TARGETS setlbf - LIBRARY DESTINATION lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) @@ -39,7 +40,7 @@ ENDIF() ADD_EXECUTABLE(procd ${SOURCES}) TARGET_LINK_LIBRARIES(procd ${LIBS}) INSTALL(TARGETS procd - RUNTIME DESTINATION sbin + RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} ) @@ -47,19 +48,19 @@ ADD_EXECUTABLE(init initd/init.c initd/early.c initd/preinit.c initd/mkdev.c wat utils/utils.c ${SOURCES_ZRAM}) TARGET_LINK_LIBRARIES(init ${LIBS}) INSTALL(TARGETS init - RUNTIME DESTINATION sbin + RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} ) ADD_EXECUTABLE(udevtrigger plug/udevtrigger.c) INSTALL(TARGETS udevtrigger - RUNTIME DESTINATION sbin + RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} ) ADD_EXECUTABLE(askfirst utils/askfirst.c) INSTALL(TARGETS askfirst - RUNTIME DESTINATION sbin + RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} ) ADD_CUSTOM_COMMAND( @@ -80,7 +81,7 @@ IF(SECCOMP_SUPPORT) ADD_LIBRARY(preload-seccomp SHARED jail/preload.c jail/seccomp.c) TARGET_LINK_LIBRARIES(preload-seccomp dl ubox blobmsg_json) INSTALL(TARGETS preload-seccomp - LIBRARY DESTINATION lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ADD_DEPENDENCIES(preload-seccomp syscall-names-h) endif() @@ -89,7 +90,7 @@ IF(JAIL_SUPPORT) ADD_EXECUTABLE(ujail jail/jail.c jail/elf.c jail/capabilities.c) TARGET_LINK_LIBRARIES(ujail ubox blobmsg_json) INSTALL(TARGETS ujail - RUNTIME DESTINATION sbin + RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} ) ADD_DEPENDENCIES(ujail capabilities-names-h) endif() @@ -98,13 +99,13 @@ IF(UTRACE_SUPPORT) ADD_EXECUTABLE(utrace trace/trace.c) TARGET_LINK_LIBRARIES(utrace ubox ${json} blobmsg_json) INSTALL(TARGETS utrace - RUNTIME DESTINATION sbin + RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} ) ADD_DEPENDENCIES(utrace syscall-names-h) ADD_LIBRARY(preload-trace SHARED trace/preload.c) TARGET_LINK_LIBRARIES(preload-trace dl) INSTALL(TARGETS preload-trace - LIBRARY DESTINATION lib + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif() -- 2.25.1