Merge branch 'installdirs' into 'master'

Allow docdir to be defined at build-time

See merge request !22
This commit is contained in:
o9000 2017-01-14 17:22:07 +00:00
commit 5041f74aad
4 changed files with 24 additions and 24 deletions

View file

@ -1,5 +1,5 @@
project( tint2 )
cmake_minimum_required( VERSION 2.6 )
cmake_minimum_required( VERSION 2.8.5 )
option( ENABLE_BATTERY "Enable battery status plugin" ON )
option( ENABLE_TINT2CONF "Enable tint2conf build, a GTK+2 theme configurator for tint2" ON )
@ -13,6 +13,14 @@ if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
option( ENABLE_UEVENT "Kernel event handling support" ON )
endif( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
include( GNUInstallDirs )
if(NOT docdir)
set(docdir ${CMAKE_INSTALL_DOCDIR})
endif()
if(NOT htmldir)
set(htmldir ${docdir}/html)
endif()
include( FindPkgConfig )
include( CheckLibraryExists )
include( CheckCSourceCompiles )
@ -200,11 +208,6 @@ else()
SET(ASAN_L_FLAGS "")
endif()
set( MANDIR share/man CACHE PATH "Directory for man pages" )
set( DATADIR share CACHE PATH "Directory for shared data" )
set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" )
set( DOCDIR share/doc/tint2 CACHE PATH "Directory for documentation files" )
add_custom_target( version ALL "${PROJECT_SOURCE_DIR}/get_version.sh" "\"${PROJECT_SOURCE_DIR}\"" )
link_directories( ${X11_LIBRARY_DIRS}
@ -243,14 +246,15 @@ set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -Wpointer-arith -fn
set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread -fno-strict-aliasing ${ASAN_L_FLAGS} ${BACKTRACE_L_FLAGS}" )
install( TARGETS tint2 DESTINATION bin )
install( FILES tint2.svg DESTINATION ${DATADIR}/icons/hicolor/scalable/apps )
install( FILES tint2.desktop DESTINATION ${DATADIR}/applications )
install( CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${DATADIR}/icons/hicolor WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})" )
install( FILES themes/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 )
install( FILES default_icon.png DESTINATION ${DATADIR}/tint2 )
install( FILES AUTHORS ChangeLog README.md doc/tint2.md doc/manual.html doc/readme.html DESTINATION ${DOCDIR} )
install( DIRECTORY doc/images DESTINATION ${DOCDIR} )
install( FILES doc/tint2.1 DESTINATION ${MANDIR}/man1 )
install( FILES tint2.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
install( FILES tint2.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
install( CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})" )
install( FILES themes/tint2rc DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/xdg/tint2 )
install( FILES default_icon.png DESTINATION ${CMAKE_INSTALL_DATADIR}/tint2 )
install( FILES AUTHORS ChangeLog README.md doc/tint2.md DESTINATION ${docdir} )
install( FILES doc/manual.html doc/readme.html DESTINATION ${htmldir} )
install( DIRECTORY doc/images DESTINATION ${htmldir} )
install( FILES doc/tint2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )
if( ENABLE_EXTRA_THEMES )
add_subdirectory(themes)
endif( ENABLE_EXTRA_THEMES )

View file

@ -57,12 +57,8 @@ target_link_libraries( tint2conf ${X11_T2C_LIBRARIES}
${GTK2_LIBRARIES}
${RSVG_LIBRARIES} )
if ( NOT DATADIR )
set(DATADIR share)
endif( NOT DATADIR )
add_definitions( -DINSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\" )
add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/${DATADIR}/locale\" )
add_definitions( -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\" )
add_definitions( -DGETTEXT_PACKAGE=\"tint2conf\" )
set_target_properties( tint2conf PROPERTIES COMPILE_FLAGS "-Wall -pthread -std=c99" )
set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" )
@ -70,6 +66,6 @@ set_target_properties( tint2conf PROPERTIES LINK_FLAGS "-pthread" )
add_subdirectory(po)
install( TARGETS tint2conf DESTINATION bin )
install( FILES tint2conf.svg DESTINATION ${DATADIR}/icons/hicolor/scalable/apps )
install( FILES tint2conf.desktop DESTINATION ${DATADIR}/applications )
install( CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${DATADIR}/icons/hicolor WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})" )
install( FILES tint2conf.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
install( FILES tint2conf.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
install( CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})" )

View file

@ -11,7 +11,7 @@ if (GETTEXT_FOUND)
foreach(LANG ${LANGUAGES})
GETTEXT_PROCESS_PO_FILES(${LANG} ALL PO_FILES ${LANG}.po)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${DATADIR}/locale/${LANG}/LC_MESSAGES"
DESTINATION "${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES"
RENAME "${GETTEXT_PACKAGE}.mo")
endforeach ()
endif()

View file

@ -1,2 +1,2 @@
file( GLOB EXTRATHEMEFILES *.tint2rc )
install( FILES ${EXTRATHEMEFILES} DESTINATION ${DATADIR}/tint2 )
install( FILES ${EXTRATHEMEFILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/tint2 )