Skip to content
Permalink
Browse files

Use GNUInstallDirs to determine install paths (#200)

The current install Paths ignore e.g. CMAKE_INSTALL_PREFIX and are
hardcoded, this allows easy install path manipulation by just passing
the needed values to cmake and not having to patch the build files
  • Loading branch information...
Johnnynator authored and DamirPorobic committed Aug 30, 2019
1 parent b120752 commit 05f741c64bc4b37ffea90ce446ffc8f7481b7f41
Showing with 8 additions and 6 deletions.
  1. +3 −1 CMakeLists.txt
  2. +4 −4 desktop/CMakeLists.txt
  3. +1 −1 src/CMakeLists.txt
@@ -7,12 +7,14 @@ endif()

set(KSNIP_VERSION "${PROJECT_VERSION}${KSNIP_VERSION_SUFIX}")

include(GNUInstallDirs)

if (WIN32)
set(KSNIP_LANG_INSTAL_DIR "translations")
elseif (APPLE)
set(KSNIP_LANG_INSTAL_DIR "../Resources")
elseif (UNIX)
set(KSNIP_LANG_INSTAL_DIR "/usr/share/ksnip/translations")
set(KSNIP_LANG_INSTAL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/ksnip/translations")
endif ()

configure_file(src/BuildConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/BuildConfig.h)
@@ -2,7 +2,7 @@
# Add metadata file

if(UNIX AND NOT APPLE)
install(PROGRAMS ksnip.desktop DESTINATION /usr/share/applications)
install(FILES ksnip.svg DESTINATION /usr/share/pixmaps)
install(FILES ksnip.appdata.xml DESTINATION /usr/share/metainfo)
endif()
install(PROGRAMS ksnip.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
install(FILES ksnip.svg DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps)
install(FILES ksnip.appdata.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo)
endif()
@@ -124,7 +124,7 @@ elseif(WIN32)
endif ()

if (UNIX AND NOT APPLE)
install(TARGETS ksnip RUNTIME DESTINATION /usr/bin)
install(TARGETS ksnip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

# uninstall target
if(NOT TARGET uninstall)

0 comments on commit 05f741c

Please sign in to comment.
You can’t perform that action at this time.