diff options
author | Li Xinwei <1326710505@qq.com> | 2020-12-16 13:32:04 +0800 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-17 11:37:54 +0000 |
commit | 845a342432b9ab07fde53b987ef694ecdc5efb62 (patch) | |
tree | ed67fe17a61a1bd6b3b1e9c761f652dde662af72 /cmake | |
parent | 0ba9e3f00ff9f3f27c19e4ad3bae9ea611963031 (diff) |
CMake: Fix module separate build error when -DFEATURE_static_runtime=ON
Build qtbase with -DFEATURE_static_runtime=ON, and then separately build
another module, following build error occurs:
error LNK2038: mismatch detected for 'RuntimeLibrary': value
'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'.
That's because all the sources in this module are compiled with 'MD'.
When separately building a module except qtbase, FEATURE_static_runtime
is not exist in cmake cache. So we should use QT_FEATURE_static_runtime
instead of FEATURE_static_runtime in qt_set_common_target_properties.
Additionally, adjust the indentation.
Change-Id: I2cf4737db9d3e8533570039a66c7d277d62a8d14
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 970e54c63d487ff5a334b8037ce0890fceb24e0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtTargetHelpers.cmake | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index fe8d461856..e4f885a512 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -188,15 +188,15 @@ function(qt_set_common_target_properties target) OBJCXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN 1) endif() - if(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_compile_pdb_names("${target}") + 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_compile_pdb_names("${target}") endfunction() # Set common, informational target properties. |