From c01ef19e772c3c5dddccf8ea03e7db4e8d71784c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 1 Mar 2012 11:40:49 +0100 Subject: [PATCH] List the dependencies of Qt when creating static libraries. Change-Id: Ib6787f982ff962cfdf3d8a0a26989489619a57b0 Reviewed-by: Clinton Stimpson Reviewed-by: Stephen Kelly --- mkspecs/cmake/Qt5BasicConfig.cmake.in | 55 ++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/mkspecs/cmake/Qt5BasicConfig.cmake.in b/mkspecs/cmake/Qt5BasicConfig.cmake.in index 45a0722ef5..0334b6f6e2 100644 --- a/mkspecs/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/cmake/Qt5BasicConfig.cmake.in @@ -35,6 +35,57 @@ if (Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) list(REMOVE_DUPLICATES Qt5$${CMAKE_MODULE_NAME}_EXECUTABLE_COMPILE_FLAGS) endif() +!!IF !isEmpty(CMAKE_STATIC_TYPE) +# For static builds, we also list the dependencies of +# Qt so that consumers can build. + +!!IF isEqual(CMAKE_MODULE_NAME, Core) + +set(Qt5Core_LIB_DEPENDENCIES) +!!IF contains(QT_CONFIG, system-zlib) +find_package(ZLIB REQUIRED) +list(APPEND Qt5Core_LIB_DEPENDENCIES ${ZLIB_LIBRARIES}) +!!ENDIF + +!!IF contains(QT_CONFIG, glib) +find_package(GTK2 REQUIRED glib-2.0 gthread-2.0) +list(APPEND Qt5Core_LIB_DEPENDENCIES ${GTK2_LIBRARIES}) +!!ENDIF + +!!IF contains(QT_CONFIG, clock-monotonic) +find_library(QT_RT_LIBRARY NAMES rt) +mark_as_advanced(QT_RT_LIBRARY) +list(APPEND Qt5Core_LIB_DEPENDENCIES ${QT_RT_LIBRARY}) +!!ENDIF + +set(CMAKE_THREAD_PREFER_PTHREADS 1) +find_package(Threads) +if(CMAKE_USE_PTHREADS_INIT) + list(APPEND Qt5Core_LIB_DEPENDENCIES ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) +endif() + +!!ENDIF # Core + +!!IF isEqual(CMAKE_MODULE_NAME, Gui) + +set(Qt5Gui_LIB_DEPENDENCIES) + +!!IF contains(QT_CONFIG, system-png) +find_package(PNG REQUIRED) +list(APPEND Qt5Gui_LIB_DEPENDENCIES ${PNG_LIBRARIES}) +!!ENDIF + +!!IF contains(QT_CONFIG, system-jpeg) +find_package(JPEG REQUIRED) +list(APPEND Qt5Gui_LIB_DEPENDENCIES ${JPEG_LIBRARIES}) +!!ENDIF + +!!ENDIF # Gui + +!!ENDIF # Static + +list(APPEND Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES "$${CMAKE_QT5_MODULE_DEPS}") + if (NOT _Qt5$${CMAKE_MODULE_NAME}_target) set(_Qt5$${CMAKE_MODULE_NAME}_target 1) !!IF !isEmpty(CMAKE_STATIC_TYPE) @@ -50,7 +101,7 @@ endif() !!IF !isEmpty(debug_type) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES - IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG \"$${CMAKE_QT5_MODULE_DEPS}\" + IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG \"${Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\" !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) IMPORTED_LOCATION_DEBUG \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" !!ELSE @@ -67,7 +118,7 @@ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES !!IF !isEmpty(release_type) set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES - IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE \"$${CMAKE_QT5_MODULE_DEPS}\" + IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE \"${Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\" !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE) IMPORTED_LOCATION_RELEASE \"${_qt5_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" !!ELSE