Skip to content

Commit

Permalink
cmake: Use GNUInstallDirs
Browse files Browse the repository at this point in the history
Makes it easier to customize the installation location and provides
similiar options as autotools.
  • Loading branch information
heirecka committed Oct 13, 2018
1 parent d0fc37d commit 1423666
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ include_directories(${Qt5X11Extras_INCLUDE_DIRS})
add_definitions(${Qt5Widgets_DEFINITIONS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")

INCLUDE(GNUInstallDirs)

INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(POPPLER poppler-qt5>=0.12.4 REQUIRED)

Expand Down
4 changes: 2 additions & 2 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ SET(DATA_FILES bestfit.png
qcomicbook-splash.png)

#INSTALL(FILES ${DATA_FILES} DESTINATION share/${PACKAGE})
INSTALL(FILES qcomicbook.png DESTINATION share/pixmaps)
INSTALL(FILES qcomicbook.desktop DESTINATION share/applications)
INSTALL(FILES qcomicbook.png DESTINATION ${CMAKE_INSTALL_DATADIR}/pixmaps)
INSTALL(FILES qcomicbook.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)

2 changes: 1 addition & 1 deletion help/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
INSTALL(FILES qcomicbook.1 DESTINATION share/man/man1)
INSTALL(FILES qcomicbook.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
2 changes: 1 addition & 1 deletion i18n/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ file (GLOB translation_src *.ts)
qt5_create_translation(qcomicbook_qm ${FILES_TO_TRANSLATE} ${translation_src})
SET_PROPERTY(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY CLEAN_NO_CUSTOM ON)
ADD_CUSTOM_TARGET(translations DEPENDS ${qcomicbook_qm})
INSTALL(FILES ${qcomicbook_qm} DESTINATION share/${PACKAGE}/i18n)
INSTALL(FILES ${qcomicbook_qm} DESTINATION ${CMAKE_INSTALL_DATADIR}/${PACKAGE}/i18n)
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ ADD_DEPENDENCIES(qcomicbook translations)
TARGET_LINK_LIBRARIES(qcomicbook Qt5::Widgets Qt5::PrintSupport Qt5::X11Extras)
TARGET_LINK_LIBRARIES(qcomicbook ${POPPLER_LIBRARIES})

INSTALL(TARGETS qcomicbook DESTINATION bin)
INSTALL(TARGETS qcomicbook DESTINATION ${CMAKE_INSTALL_BINDIR})

4 changes: 2 additions & 2 deletions src/config.h.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __CONFIG_H
#define __CONFIG_H

#define DATADIR "@CMAKE_INSTALL_PREFIX@/share/@PACKAGE@"
#define DATADIR "@CMAKE_INSTALL_FULL_DATADIR@/@PACKAGE@"
#define VERSION "@VERSION@"

#endif
#endif

0 comments on commit 1423666

Please sign in to comment.