diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-01-03 13:51:39 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-01-06 12:48:40 +0100 |
commit | cca279338c5778fe09fa52384a1ffa5531885cf5 (patch) | |
tree | d2a3ffb86bce71feb52f99772f90df674e3ad05e /mkspecs | |
parent | 6b835d5e51bafe93090286fa2acb36f3d5d8f719 (diff) |
CMake: Fix usage requirements for static builds of Qt on macOS
When scanning the prl files to set up usage requirements for the Qt libraries
we omitted "-framework Foo" flags. Those were passed as linker flags, but not
as interface libraries. Consequently, the frameworks that are used by Qt
libraries were missing on the link line when building against a statically
built Qt.
Fix this issue by scanning the dependencies for "-framework Foo" just like we
do with "-lfoo" flags.
Fixes: QTBUG-80855
Change-Id: Ie7804304141c86207d143a6e1005e78bdc099113
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Kyle Edwards <kyle.edwards@kitware.com>
Diffstat (limited to 'mkspecs')
-rw-r--r-- | mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in index 5077b8d8b4..26d4c17e6c 100644 --- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in +++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in @@ -72,18 +72,28 @@ function(_qt5_$${CMAKE_MODULE_NAME}_process_prl_file prl_file_location Configura string(REGEX REPLACE \"QMAKE_PRL_LIBS_FOR_CMAKE[ \\t]*=[ \\t]*([^\\n]*)\" \"\\\\1\" _static_depends \"${_prl_strings}\") string(REGEX REPLACE \"[ \\t]+\" \";\" _standard_libraries \"${CMAKE_CXX_STANDARD_LIBRARIES}\") set(_search_paths) + set(_framework_flag) string(REPLACE \"\\$\\$[QT_INSTALL_LIBS]\" \"${_qt5_install_libs}\" _static_depends \"${_static_depends}\") foreach(_flag ${_static_depends}) string(REPLACE \"\\\"\" \"\" _flag ${_flag}) - if(_flag MATCHES \"^-l(.*)$\") - # Handle normal libraries passed as -lfoo - set(_lib \"${CMAKE_MATCH_1}\") - foreach(_standard_library ${_standard_libraries}) - if(_standard_library MATCHES \"^${_lib}(\\\\.lib)?$\") - set(_lib_is_default_linked TRUE) - break() - endif() - endforeach() + if(_flag MATCHES \"^-framework$\") + # Handle the next flag as framework name + set(_framework_flag 1) + elseif(_framework_flag OR _flag MATCHES \"^-l(.*)$\") + if(_framework_flag) + # Handle Darwin framework bundles passed as -framework Foo + unset(_framework_flag) + set(_lib ${_flag}) + else() + # Handle normal libraries passed as -lfoo + set(_lib \"${CMAKE_MATCH_1}\") + foreach(_standard_library ${_standard_libraries}) + if(_standard_library MATCHES \"^${_lib}(\\\\.lib)?$\") + set(_lib_is_default_linked TRUE) + break() + endif() + endforeach() + endif() if (_lib_is_default_linked) unset(_lib_is_default_linked) elseif(_lib MATCHES \"^pthread$\") |