X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=cmake%2Fmodules%2FFindPhonon.cmake;h=ab0a86c8d934675a892e80ddee9e0cdf46d9959a;hp=daa457ad0fe130ee949e66c8d0ae5ead9eff54da;hb=bd93ccbd15b6071165ac32ffe6e33768526db6f2;hpb=bb49ea8fb3d3ecfbe8fb87688df6f215d29ad944 diff --git a/cmake/modules/FindPhonon.cmake b/cmake/modules/FindPhonon.cmake index daa457ad..ab0a86c8 100644 --- a/cmake/modules/FindPhonon.cmake +++ b/cmake/modules/FindPhonon.cmake @@ -30,13 +30,27 @@ else(PHONON_FOUND) set(PHONON_FIND_QUIETLY TRUE) endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - # As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir) - find_library(PHONON_LIBRARY NAMES phonon PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - # then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.) - find_library(PHONON_LIBRARY NAMES phonon) + find_library(PHONON_LIBRARY_RELEASE NAMES phonon phonon4 HINTS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR}) + find_library(PHONON_LIBRARY_DEBUG NAMES phonond phonond4 HINTS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR}) - find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH) - find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h) + # if the release- as well as the debug-version of the library have been found: + IF (PHONON_LIBRARY_DEBUG AND PHONON_LIBRARY_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(PHONON_LIBRARY optimized ${PHONON_LIBRARY_RELEASE} debug ${PHONON_LIBRARY_DEBUG}) + ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(PHONON_LIBRARY ${PHONON_LIBRARY_RELEASE} ) + ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + ELSE(PHONON_LIBRARY_DEBUG AND PHONON_LIBRARY_RELEASE) + IF (PHONON_LIBRARY_RELEASE) + SET(PHONON_LIBRARY ${PHONON_LIBRARY_RELEASE}) + ENDIF (PHONON_LIBRARY_RELEASE) + ENDIF (PHONON_LIBRARY_DEBUG AND PHONON_LIBRARY_RELEASE) + + find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h HINTS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR}) if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY}) @@ -47,25 +61,8 @@ else(PHONON_FOUND) set(PHONON_FOUND FALSE) endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY) - if(PHONON_FOUND) - if(NOT PHONON_FIND_QUIETLY) - message(STATUS "Found Phonon: ${PHONON_LIBRARY}") - message(STATUS "Found Phonon Includes: ${PHONON_INCLUDES}") - endif(NOT PHONON_FIND_QUIETLY) - else(PHONON_FOUND) - if(Phonon_FIND_REQUIRED) - if(NOT PHONON_INCLUDE_DIR) - message(STATUS "Phonon includes NOT found!") - endif(NOT PHONON_INCLUDE_DIR) - if(NOT PHONON_LIBRARY) - message(STATUS "Phonon library NOT found!") - endif(NOT PHONON_LIBRARY) - message(FATAL_ERROR "Phonon library or includes NOT found!") - else(Phonon_FIND_REQUIRED) - message(STATUS "Unable to find Phonon") - endif(Phonon_FIND_REQUIRED) - endif(PHONON_FOUND) - + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(Phonon DEFAULT_MSG PHONON_INCLUDE_DIR PHONON_LIBRARY) - mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY PHONON_INCLUDES) + mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY) endif(PHONON_FOUND)