summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorLi Xinwei <1326710505@qq.com>2020-12-16 13:32:04 +0800
committerLi Xinwei <1326710505@qq.com>2020-12-17 01:18:19 +0800
commit970e54c63d487ff5a334b8037ce0890fceb24e0f (patch)
treeddb9a1c899f43ab4b120c08a35ba27921392ffea /cmake
parent796de4f0668cc4b38f9e8653a0b2f53f0b3423b9 (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. Pick-to: 6.0 Change-Id: I2cf4737db9d3e8533570039a66c7d277d62a8d14 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtTargetHelpers.cmake18
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.