aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2010-01-06 22:22:22 +0000
committerAlexander Neundorf <neundorf@kde.org>2010-01-06 22:22:22 +0000
commitbe71e39f528e26bfc1ff97ef2b615bc515342a05 (patch)
treebdba5a2ff4870d3010074a223cef974d96753a5d
parent028b0d21b6bcdad6ae71bb35748261af900d492c (diff)
downloadextra-cmake-modules-be71e39f528e26bfc1ff97ef2b615bc515342a05.tar.gz
extra-cmake-modules-be71e39f528e26bfc1ff97ef2b615bc515342a05.tar.bz2
-introduce imported targets for the various Qt4 libraries, so we can handle the release- and debug-libraries finally properly.
Tested on my machine with Linux with kdelibs, kdeutils and some other module, and also tested under Windows by Saro. If you suddenly get strange linking-related errors with Qt4 libraries, please let me know ASAP. This should also help the installation of KDE under Windows, since with these imported Qt libraries the location of the Qt-libraries is not fixed at kdelibs-buildtime anymore (for the installed dependencies-file), but determined at 3rd-party cmake-time. So different locations of Qt on a Windows-development machine should be no problem anymore. (I'd like to have some feedback on this ) Alex CCMAIL: kde-windows@kde.org CCMAIL: kde-buildsystem@kde.org CCMAIL: <ps_ml@gmx.de> svn path=/trunk/KDE/kdelibs/; revision=1070849
-rw-r--r--modules/FindQt4.cmake57
1 files changed, 27 insertions, 30 deletions
diff --git a/modules/FindQt4.cmake b/modules/FindQt4.cmake
index 864828f8..941e2e40 100644
--- a/modules/FindQt4.cmake
+++ b/modules/FindQt4.cmake
@@ -892,38 +892,35 @@ IF (QT4_QMAKE_FOUND)
############################################
MACRO (_QT4_ADJUST_LIB_VARS basename)
+# message(STATUS "Adjusting ${basename}, release: -${QT_${basename}_LIBRARY_RELEASE}- debug: -${QT_${basename}_LIBRARY_DEBUG}-")
IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
+ ADD_LIBRARY(Qt4__${basename} SHARED IMPORTED )
- # if the release- as well as the debug-version of the library have been found:
- IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_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(QT_${basename}_LIBRARY optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_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(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE} )
- ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
- SET(QT_${basename}_LIBRARIES optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG})
- ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE)
-
- # if only the release version was found, set the debug variable also to the release version
- IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
- SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE})
- SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_RELEASE})
- SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_RELEASE})
- ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG)
-
- # if only the debug version was found, set the release variable also to the debug version
- IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
- SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG})
- SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY_DEBUG})
- SET(QT_${basename}_LIBRARIES ${QT_${basename}_LIBRARY_DEBUG})
- ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE)
-
- # put the value in the cache:
- SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE)
+ IF(WIN32)
+ SET(_QT4_LIBRARY_PROPERTY_NAME IMPLIB)
+ ELSE(WIN32)
+ SET(_QT4_LIBRARY_PROPERTY_NAME LOCATION)
+ ENDIF(WIN32)
+
+
+ IF (QT_${basename}_LIBRARY_RELEASE)
+ SET_PROPERTY(TARGET Qt4__${basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ SET_PROPERTY(TARGET Qt4__${basename} PROPERTY IMPORTED_${_QT4_LIBRARY_PROPERTY_NAME}_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" )
+# message(STATUS "Setting IMPORTED_LOCATION_RELEASE to -${QT_${basename}_LIBRARY_RELEASE}-")
+ ENDIF (QT_${basename}_LIBRARY_RELEASE)
+
+ IF (QT_${basename}_LIBRARY_DEBUG)
+ SET_PROPERTY(TARGET Qt4__${basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ SET_PROPERTY(TARGET Qt4__${basename} PROPERTY IMPORTED_${_QT4_LIBRARY_PROPERTY_NAME}_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
+
+# message(STATUS "Setting IMPORTED_LOCATION_DEBUG to -${QT_${basename}_LIBRARY_DEBUG}-")
+
+ SET_PROPERTY(TARGET Qt4__${basename} PROPERTY MAP_IMPORTED_CONFIG_PROFILE DEBUG)
+ SET_PROPERTY(TARGET Qt4__${basename} PROPERTY MAP_IMPORTED_CONFIG_DEBUGFULL DEBUG)
+ ENDIF (QT_${basename}_LIBRARY_DEBUG)
+
+ SET(QT_${basename}_LIBRARY Qt4__${basename} )
+ SET(QT_${basename}_LIBRARIES Qt4__${basename} )
IF (QT_${basename}_LIBRARY)
SET(QT_${basename}_FOUND 1)