summaryrefslogtreecommitdiffstats
path: root/cmake/QtTargetHelpers.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-07-08 14:01:59 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-09 11:14:59 +0000
commitac7a862e9b8317cda0fac329be0ff306c3c99c9b (patch)
tree130e5a7ccf6b58a701a0a7e1b71da668eac0ea5d /cmake/QtTargetHelpers.cmake
parentde22784495ae0e85acf75665ea445d460224871e (diff)
CMake: Use correct MSVC runtime library for Qt object libraries
If Qt was configured with -static-runtime which implies MultiThreaded -MT flag, the plugin initializer object libraries were still compiled with the default -MD flag. When an application linked to Qt, that caused linking to fail with mismatched symbol errors between the application symbols and the plugin initializer object library symbols. Make sure to set the MSVC_RUNTIME_LIBRARY property on both plugin initializer and resource object libraries, depending on the value of QT_FEATURE_static_runtime. We did set the property for resources added by qt_internal_add_resource, but not for the resource created by the public qt6_add_resources counterpart. Fixes: QTBUG-95043 Change-Id: Ia543cd0241db94a12080be2655ad420fe9ad3f24 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 51ae235080df7f051e65883a90731685649f2957) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake/QtTargetHelpers.cmake')
-rw-r--r--cmake/QtTargetHelpers.cmake9
1 files changed, 1 insertions, 8 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake
index 266bcac490..bc1d8f3620 100644
--- a/cmake/QtTargetHelpers.cmake
+++ b/cmake/QtTargetHelpers.cmake
@@ -188,14 +188,7 @@ function(qt_set_common_target_properties target)
OBJCXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN 1)
endif()
- if(QT_FEATURE_static_runtime)
- if(MSVC)
- set_property(TARGET ${target} PROPERTY
- MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
- elseif(MINGW)
- target_link_options(${target} INTERFACE "LINKER:-static")
- endif()
- endif()
+ _qt_internal_set_up_static_runtime_library("${target}")
qt_internal_set_compile_pdb_names("${target}")
endfunction()