summaryrefslogtreecommitdiffstats
path: root/Modules/Qt4ConfigDependentSettings.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Qt4ConfigDependentSettings.cmake')
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake32
1 files changed, 25 insertions, 7 deletions
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index 1fe7728..0c440b6 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -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