Define _CRT_SECURE_NO_WARNINGS if MSVC CRT is used

Suppress the following MSVC compiler warnings:
src\source\cpu_id.cc(140): warning C4996: 'fopen': This function or
variable may be unsafe. Consider using fopen_s instead. To disable
deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
src\source\cpu_id.cc(169): warning C4996: 'fopen': This function or
variable may be unsafe. Consider using fopen_s instead. To disable
deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

Note that build/config/win/BUILD.gn defines _CRT_SECURE_NO_DEPRECATE
instead. _CRT_SECURE_NO_WARNINGS is the new name of the macro. See
https://docs.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt?view=msvc-140

Bug: libyuv:939
Change-Id: I0d1715b31e672126c35e29b99f5cbf08e4338f40
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3807104
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Wan-Teh Chang 2022-08-03 09:53:43 -07:00 committed by Frank Barchard
parent 02b8b88548
commit ab046f1dfc

View File

@ -22,6 +22,10 @@ LIST ( SORT ly_unittest_sources )
INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} )
if(MSVC)
ADD_DEFINITIONS ( -D_CRT_SECURE_NO_WARNINGS )
endif()
# this creates the static library (.a)
ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} )