[Cmake-commits] [cmake-commits] alex committed FindQt4.cmake 1.186 1.187

cmake-commits at cmake.org cmake-commits at cmake.org
Sun Jan 17 11:38:00 EST 2010


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv6838

Modified Files:
	FindQt4.cmake 
Log Message:
-create imported library targets for the Qt4 libs

This commit syncs FindQt4.cmake again with KDEs version.
Now for every Qt library an imported target with the name
Qt4ImportedTarget__<LIBNAME> is created. 
This way we can now finally handle the release and debug versions of the Qt
libraries correctly.
Also, if a Qt-using project A installs a file with exported targets, these
targets now depend on the imported Qt targets, e.g.
Qt4ImportedTarget__QtCore. The location of QtCore is then resolved at
buildtime of project B, which uses the exported targets from project A.
 Before this patch the full path to the QtCore on the original build machine
of project A was stored, so this had to match the directory layout on the
build machine for project B.

Alex


Index: FindQt4.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/FindQt4.cmake,v
retrieving revision 1.186
retrieving revision 1.187
diff -C 2 -d -r1.186 -r1.187
*** FindQt4.cmake	13 Jan 2010 22:34:31 -0000	1.186
--- FindQt4.cmake	17 Jan 2010 16:37:53 -0000	1.187
***************
*** 838,878 ****
  
    MACRO (_QT4_ADJUST_LIB_VARS basename)
      IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
  
!       # 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 (QT_${basename}_LIBRARY)
!         SET(QT_${basename}_FOUND 1)
!       ENDIF (QT_${basename}_LIBRARY)
  
      ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
  
--- 838,876 ----
  
    MACRO (_QT4_ADJUST_LIB_VARS basename)
+     # The name of the imported targets, i.e. the prefix "Qt4ImportedTarget__" must not change,
+     # since it is stored in EXPORT-files as name of a required library. If the name would change
+     # here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore.
      IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
+       IF(NOT TARGET Qt4ImportedTarget__${basename})
+         ADD_LIBRARY(Qt4ImportedTarget__${basename} SHARED IMPORTED )
  
!         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 Qt4ImportedTarget__${basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
!           SET_PROPERTY(TARGET Qt4ImportedTarget__${basename}        PROPERTY IMPORTED_${_QT4_LIBRARY_PROPERTY_NAME}_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" )
!         ENDIF (QT_${basename}_LIBRARY_RELEASE)
  
!         IF (QT_${basename}_LIBRARY_DEBUG)
!           SET_PROPERTY(TARGET Qt4ImportedTarget__${basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
!           SET_PROPERTY(TARGET Qt4ImportedTarget__${basename}        PROPERTY IMPORTED_${_QT4_LIBRARY_PROPERTY_NAME}_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
  
!           SET_PROPERTY(TARGET Qt4ImportedTarget__${basename} PROPERTY MAP_IMPORTED_CONFIG_PROFILE   DEBUG)
!           SET_PROPERTY(TARGET Qt4ImportedTarget__${basename} PROPERTY MAP_IMPORTED_CONFIG_DEBUGFULL DEBUG)
!         ENDIF (QT_${basename}_LIBRARY_DEBUG)
! 
!         SET(QT_${basename}_LIBRARY       Qt4ImportedTarget__${basename} )
!         SET(QT_${basename}_LIBRARIES     Qt4ImportedTarget__${basename} )
  
+         IF (QT_${basename}_LIBRARY)
+           SET(QT_${basename}_FOUND 1)
+         ENDIF (QT_${basename}_LIBRARY)
+ 
+       ENDIF(NOT TARGET Qt4ImportedTarget__${basename})
      ENDIF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG)
  



More information about the Cmake-commits mailing list