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. Change-Id: I9c37b20672f9d0f470e3e9ea847e5221f43bfc04 Reviewed-by: Yuhang Zhao <2546789017@qq.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit c7a27678d6916a51848c991fb3ee21acc6a6f8ca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
20a9f74851
commit
83dbe0af20
@ -151,6 +151,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()
|
||||||
|
@ -357,10 +357,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