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>
This commit is contained in:
parent
796de4f066
commit
970e54c63d
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user