From 24d9cce3a8562d694b9cb08da19c19a347a380d5 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Mon, 11 Apr 2011 15:36:29 -0400 Subject: [PATCH] Install a .protocol file on KDE so tomahawk:// links work there too --- CMakeLists.txt | 17 ++++++++++++++--- admin/unix/tomahawk.protocol | 2 +- src/CMakeLists.txt | 12 +++++++++++- thirdparty/alsa-playback/CMakeLists.txt | 2 ++ thirdparty/jdns/CMakeLists.txt | 2 ++ thirdparty/libportfwd/CMakeLists.txt | 2 ++ 6 files changed, 32 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dde40af13..b69c77148 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,12 +47,22 @@ macro_log_feature(TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://develo # we need pthreads too find_package(Threads) +find_package(KDE4) +IF(KDE4_FOUND) + #KDE4 adds and removes some compiler flags that we don't like + STRING( REPLACE "-std=iso9899:1990" "" CLEAN_C_FLAGS ${CMAKE_C_FLAGS} ) + SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" ) +ELSE() + SET( CLEAN_C_FLAGS ${CMAKE_C_FLAGS} ) +ENDIF() + include( CheckTagLibFileName ) check_taglib_filename( COMPLEX_TAGLIB_FILENAME ) # optional macro_optional_find_package(Jreen) IF( ENABLE_JREEN AND NOT LIBJREEN_FOUND ) + ADD_SUBDIRECTORY( thirdparty/jreen ) SET( LIBJREEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/thirdparty/jreen/include ) IF( UNIX AND NOT APPLE ) @@ -92,9 +102,10 @@ CONFIGURE_FILE( "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) -ADD_CUSTOM_TARGET(uninstall - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") - +# KDE4 defines an uninstall target for us automatically +IF( NOT KDE4_FOUND ) + ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") +ENDIF() IF( NOT APPLE ) # Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often diff --git a/admin/unix/tomahawk.protocol b/admin/unix/tomahawk.protocol index 3a393aa61..f342fb39c 100644 --- a/admin/unix/tomahawk.protocol +++ b/admin/unix/tomahawk.protocol @@ -1,5 +1,5 @@ [Protocol] -exec=/home/leo/kde/tomahawk/build/tomahawk "%u" +exec=/path/to/binary "%u" protocol=tomahawk input=none output=none diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a28f4d97b..8bc02ece4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -120,7 +120,7 @@ SET( tomahawkUI ${tomahawkUI} ) INCLUDE_DIRECTORIES( - . + . ${TOMAHAWK_INC_DIR} ${CMAKE_CURRENT_BINARY_DIR} @@ -237,4 +237,14 @@ 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) + 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} ) +ENDIF() #INCLUDE( "CPack.txt" ) diff --git a/thirdparty/alsa-playback/CMakeLists.txt b/thirdparty/alsa-playback/CMakeLists.txt index 4a4e98d99..b8fe19f7f 100644 --- a/thirdparty/alsa-playback/CMakeLists.txt +++ b/thirdparty/alsa-playback/CMakeLists.txt @@ -12,6 +12,8 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") +SET( CMAKE_C_FLAGS ${CLEAN_C_FLAGS} ) + #ADD_DEFINITIONS(-Wall -O2 -DNDEBUG) ADD_DEFINITIONS(-fPIC) diff --git a/thirdparty/jdns/CMakeLists.txt b/thirdparty/jdns/CMakeLists.txt index 85667cb7e..70df58ed4 100644 --- a/thirdparty/jdns/CMakeLists.txt +++ b/thirdparty/jdns/CMakeLists.txt @@ -9,6 +9,8 @@ INCLUDE( ${QT_USE_FILE} ) add_definitions( ${QT_DEFINITIONS} ) add_definitions( -DQT_SHARED ) +SET( CMAKE_C_FLAGS ${CLEAN_C_FLAGS} ) + if(WIN32) set(PLATFORM_SPECIFIC_LIBS "ws2_32.dll" "advapi32.dll" ) endif(WIN32) diff --git a/thirdparty/libportfwd/CMakeLists.txt b/thirdparty/libportfwd/CMakeLists.txt index c301bf95b..e19485414 100644 --- a/thirdparty/libportfwd/CMakeLists.txt +++ b/thirdparty/libportfwd/CMakeLists.txt @@ -17,6 +17,8 @@ ELSE() ENDIF() INCLUDE_DIRECTORIES(${MINIUPNP_DIR} include) +SET( CMAKE_C_FLAGS ${CLEAN_C_FLAGS} ) + ADD_LIBRARY(portfwd STATIC # the needed bits of miniupnpc (no python module, no tests, no cli)