BUG: Fix #10021 don't specify libraries Qt depends on unless Qt is static.

This commit is contained in:
Clinton Stimpson 2009-12-15 16:16:45 -05:00
parent 633c296552
commit 56ee3b43a9
2 changed files with 29 additions and 8 deletions

View File

@ -22,8 +22,7 @@
# find dependencies for some Qt modules
# when doing builds against a static Qt, they are required
# when doing builds against a shared Qt, they are sometimes not required
# even some Linux distros do not require these dependencies
# when doing builds against a shared Qt, they are not required
# if a user needs the dependencies, and they couldn't be found, they can set
# the variables themselves.
@ -35,12 +34,31 @@ SET(QT_QTDBUS_LIB_DEPENDENCIES "")
SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY})
# build using shared Qt needs -DQT_DLL
IF(WIN32 AND NOT QT_CONFIG MATCHES "static")
# warning currently only qconfig.pri on Windows potentially contains "static"
# so QT_DLL might not get defined properly on other platforms.
IF(WIN32)
# On Windows, qconfig.pri has "static" for static library builds
IF(QT_CONFIG MATCHES "static")
SET(QT_IS_STATIC 1)
ENDIF(QT_CONFIG MATCHES "static")
ELSE(WIN32)
# On other platforms, check file extension to know if its static
IF(QT_QTCORE_LIBRARY_RELEASE)
GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_RELEASE}" EXT)
IF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX})
SET(QT_IS_STATIC 1)
ENDIF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX})
ENDIF(QT_QTCORE_LIBRARY_RELEASE)
IF(QT_QTCORE_LIBRARY_DEBUG)
GET_FILENAME_COMPONENT(qtcore_lib_ext "${QT_QTCORE_LIBRARY_DEBUG}" EXT)
IF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX})
SET(QT_IS_STATIC 1)
ENDIF(${qtcore_lib_ext} STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX})
ENDIF(QT_QTCORE_LIBRARY_DEBUG)
ENDIF(WIN32)
# build using shared Qt needs -DQT_DLL on Windows
IF(WIN32 AND NOT QT_IS_STATIC)
SET(QT_DEFINITIONS ${QT_DEFINITIONS} -DQT_DLL)
ENDIF(WIN32 AND NOT QT_CONFIG MATCHES "static")
ENDIF(WIN32 AND NOT QT_IS_STATIC)
# QtOpenGL dependencies

View File

@ -80,7 +80,10 @@ FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB)
INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR})
ENDIF(QT_USE_${module})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY} ${QT_${module}_LIB_DEPENDENCIES})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
IF(QT_IS_STATIC)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
ENDIF(QT_IS_STATIC)
FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
SET(QT_USE_${depend_module}_DEPENDS 1)
ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})