1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-14 04:51:53 +02:00

Add a module to find whether KDE4 is installed rather than whether it has a proper development environment, and use that for controlling protocol file installation

This commit is contained in:
Jeff Mitchell 2011-05-20 11:47:16 -04:00
parent cd29484d52
commit f3406e18b6
3 changed files with 29 additions and 3 deletions

View File

@ -82,6 +82,7 @@ macro_log_feature(LIBJREEN_FOUND "Jreen" "Qt XMPP Library" "http://gitorious.org
# we need pthreads too
find_package(Threads)
find_package(KDE4Installed)
find_package(KDE4)
IF(KDE4_FOUND)
#KDE4 adds and removes some compiler flags that we don't like

View File

@ -0,0 +1,20 @@
# Simple hack to detect wether KDE4 is *installed* -- not anything about the development environment!
FILE(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
# For KDE4 kde-config has been renamed to kde4-config
FIND_PROGRAM(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config
# the suffix must be used since KDEDIRS can be a list of directories which don't have bin/ appended
PATH_SUFFIXES bin
HINTS
${CMAKE_INSTALL_PREFIX}
${_KDEDIRS}
/opt/kde4
ONLY_CMAKE_FIND_ROOT_PATH
)
IF (KDE4_KDECONFIG_EXECUTABLE)
SET (KDE4_INSTALLED TRUE)
message(STATUS "KDE4 is installed, will install protocol file")
ENDIF (KDE4_KDECONFIG_EXECUTABLE)

View File

@ -243,14 +243,19 @@ ENDIF( APPLE )
INSTALL( TARGETS tomahawk BUNDLE DESTINATION . RUNTIME DESTINATION bin )
IF(KDE4_FOUND) #install protocol file
FILE(READ ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.protocol protocol)
IF( UNIX AND NOT APPLE AND KDE4_INSTALLED ) #install protocol file
FILE( READ ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.protocol protocol )
STRING( REPLACE "/path/to/binary" # match this
"${CMAKE_INSTALL_PREFIX}/bin/tomahawk" # this is linux (kde) so pretty safe I think
edited_protocol # save in this variable
"${protocol}" # from the contents of this var
)
FILE( WRITE ${CMAKE_BINARY_DIR}/tomahawk.protocol "${edited_protocol}" )
INSTALL( FILES ${CMAKE_BINARY_DIR}/tomahawk.protocol DESTINATION ${SERVICES_INSTALL_DIR} )
IF( ${SERVICES_INSTALL_DIR} )
SET( PROTOCOL_INSTALL_DIR ${SERVICES_INSTALL_DIR} )
ELSE()
SET( PROTOCOL_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/kde4/services" )
ENDIF()
INSTALL( FILES ${CMAKE_BINARY_DIR}/tomahawk.protocol DESTINATION ${PROTOCOL_INSTALL_DIR} )
ENDIF()
#INCLUDE( "CPack.txt" )