Hello,
The attached patch makes FindPhonon.cmake find release and debug variants of
the Phonon library. This is most useful on Windows. After applying this
patch, release builds of KDE will link to the release variant of Phonon, and
debug builds of KDE will link to the debug variant of Phonon.
New variables (PHONON_LIBRARY_RELEASE, PHONON_LIBRARY_DEBUG) are introduced
but they should never be used directly. If no debug variant of Phonon is
found, PHONON_LIBS is set to the release version.
For backwards compatibily, PHONON_LIBRARY is set to the value of
PHONON_LIBRARY_RELEASE, although PHONON_LIBRARY should never have been used
anywhere.
We have been using this at work for some time now, both on Windows and
Linux, and it works fine for us.
Is it OK to commit?
--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
--- FindPhonon.cmake-1057166 2010-01-18 18:50:43.917728683 +0100
+++ FindPhonon.cmake 2010-01-18 18:52:33.436121567 +0100
@@ -26,26 +26,44 @@ if(PHONON_FOUND)
# Already found, nothing more to do except figuring out the version
_phonon_find_version()
else(PHONON_FOUND)
- if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+ if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY_RELEASE AND PHONON_LIBRARY_DEBUG)
set(PHONON_FIND_QUIETLY TRUE)
- endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+ endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY_RELEASE AND PHONON_LIBRARY_DEBUG)
# 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)
+ find_library(PHONON_LIBRARY_RELEASE NAMES phonon phonon4 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 )
+
+ # For backwards compatibility
+ set( PHONON_LIBRARY ${PHONON_LIBRARY_RELEASE} )
+
+ # As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir)
+ find_library(PHONON_LIBRARY_DEBUG NAMES phonond phonon4d 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_DEBUG NAMES phonond phonond4 phonon phonon4 HINTS /usr/lib/debug/usr/lib )
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(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
- set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY})
- set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR})
+ if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY_RELEASE AND PHONON_LIBRARY_DEBUG)
+ if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ set(PHONON_LIBS ${phonon_LIB_DEPENDS} optimized ${PHONON_LIBRARY_RELEASE} debug ${PHONON_LIBRARY_DEBUG})
+ else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY_RELEASE})
+ endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+
+ set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}/phonon ${PHONON_INCLUDE_DIR})
set(PHONON_FOUND TRUE)
_phonon_find_version()
- else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+ elseif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY_RELEASE)
+ set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY_RELEASE})
+ set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR}/phonon ${PHONON_INCLUDE_DIR})
+ set(PHONON_FOUND TRUE)
+ _phonon_find_version()
+ else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY_RELEASE AND PHONON_LIBRARY_DEBUG)
set(PHONON_FOUND FALSE)
- endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+ endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY_RELEASE AND PHONON_LIBRARY_DEBUG)
if(PHONON_FOUND)
if(NOT PHONON_FIND_QUIETLY)
_______________________________________________
Kde-windows mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-windows