>From e04aaaf4940f3886544d678848af39443bfff249 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler
Date: Sat, 7 Apr 2018 22:23:58 +0100 Subject: [PATCH 18/19] CMakeLists.txt: Use GNU installation paths The GNUInstallDirs macro makes it possible for the user to override the destination paths for library and headers. It also automatically installs to lib64/ if that's the distro default. The installation components are marked in case someone makes a CPack installer. --- CMakeLists.txt | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b6534099..10d2bbca1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -392,34 +392,38 @@ if (HARFBUZZ_FOUND) endif () -# Installations -# Note the trailing slash in the argument to the `DIRECTORY' directive +# Installation +include(GNUInstallDirs) + if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ - DESTINATION include/freetype2 - PATTERN "internal" EXCLUDE - PATTERN "ftconfig.h" EXCLUDE - PATTERN "ftoption.h" EXCLUDE - ) - install(FILES - ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h - ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h - DESTINATION include/freetype2/freetype/config - ) + install( + # Note the trailing slash in the argument to `DIRECTORY'! + DIRECTORY ${PROJECT_SOURCE_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2 + COMPONENT headers + PATTERN "internal" EXCLUDE + PATTERN "ftconfig.h" EXCLUDE + PATTERN "ftoption.h" EXCLUDE) + install( + FILES ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h + ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2/freetype/config + COMPONENT headers) endif () if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) - install(TARGETS freetype + install( + TARGETS freetype + EXPORT freetype-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + FRAMEWORK DESTINATION Library/Frameworks + COMPONENT libraries) + install( EXPORT freetype-targets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - FRAMEWORK DESTINATION Library/Frameworks - ) - install(EXPORT freetype-targets - DESTINATION lib/cmake/freetype - FILE freetype-config.cmake - ) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype + FILE freetype-config.cmake + COMPONENT headers) endif () -- 2.14.3