From 8c922684dd2618ffb935d025135071df1d0502a6 Mon Sep 17 00:00:00 2001 From: Tom M Date: Wed, 6 Jul 2016 05:53:42 +0200 Subject: [PATCH] cmake: dont hardcode install paths --- CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2edf98f..8769e13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) PROJECT(libcue) +include(GNUInstallDirs) + + SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") ADD_DEFINITIONS(-DPACKAGE_VERSION="${PACKAGE_VERSION}") ADD_DEFINITIONS(-DPACKAGE_STRING="${PACKAGE_STRING}") @@ -19,7 +22,7 @@ SET (CUE_SOURCES CONFIGURE_FILE(libcue.pc.in libcue.pc @ONLY) INSTALL(FILES ${CMAKE_BINARY_DIR}/libcue.pc - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) # for generated files @@ -44,14 +47,14 @@ SET_TARGET_PROPERTIES (cue C_VISIBILITY_PRESET hidden) INSTALL(TARGETS cue - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/libcue.h DESTINATION include) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/libcue.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) if(CMAKE_HOST_UNIX) - INSTALL(DIRECTORY DESTINATION include/libcue) + INSTALL(DIRECTORY DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libcue) INSTALL(CODE " EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ../libcue.h - \$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/include/libcue/libcue.h) + \$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcue/libcue.h) ") endif(CMAKE_HOST_UNIX)