MSVC: define _CRT_SECURE_NO_WARNINGS for all internal CMake targets
In commit 013abe320680b3dcd3f6d7e4fb4880e590ba10e6, I add _CRT_SECURE_NO_WARNINGS definition for all Qt internal module targets, to suppress MSVC warnings like: warning C4996: 'strncpy': This function or variable may be unsafe. However, when compiling some internal tools, such as qmake and qdoc, such warnings also exist. To suppress this kind of warning entirely, _CRT_SECURE_NO_WARNINGS definition should be added for all Qt internal targets when using MSVC compiler. Pick-to: 6.1 Change-Id: I9c37b20672f9d0f470e3e9ea847e5221f43bfc04 Reviewed-by: Yuhang Zhao <2546789017@qq.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
e99a883bd3
commit
c7a27678d6
@ -152,6 +152,7 @@ if(WIN32)
|
|||||||
target_compile_definitions(PlatformCommonInternal INTERFACE "UNICODE;_UNICODE")
|
target_compile_definitions(PlatformCommonInternal INTERFACE "UNICODE;_UNICODE")
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_definitions(PlatformCommonInternal INTERFACE
|
target_compile_definitions(PlatformCommonInternal INTERFACE
|
||||||
|
"_CRT_SECURE_NO_WARNINGS"
|
||||||
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:_WINDLL>"
|
"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:_WINDLL>"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -358,10 +358,6 @@ function(qt_internal_add_module target)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
list(APPEND defines_for_extend_target _CRT_SECURE_NO_WARNINGS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
qt_internal_extend_target("${target}"
|
qt_internal_extend_target("${target}"
|
||||||
${header_module}
|
${header_module}
|
||||||
SOURCES ${arg_SOURCES}
|
SOURCES ${arg_SOURCES}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user