Skip to content

Commit f8c4c07

Browse files
authored
tests : add _CRT_SECURE_NO_WARNINGS for WIN32 (#8231)
This commit adds the compile definition `_CRT_SECURE_NO_WARNINGS` to the root cmake subproject. The motivation for this is that currently the following warnings are displayed when compiling the tests and common cmake subprojects: ```console test-llama-grammar.cpp C:\llama.cpp\src\.\llama.cpp(1406,77): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\llama.cpp\build\tests\test-llama-grammar.vcxproj] ... ``` This compile definition is currently set for the `src` subproject and this change moves into the root cmake project so that it is applied to all cmake subprojects.
1 parent 402d6fe commit f8c4c07

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ endif()
4242

4343
option(BUILD_SHARED_LIBS "build shared libraries" ${BUILD_SHARED_LIBS_DEFAULT})
4444

45+
if (WIN32)
46+
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
47+
endif()
48+
4549
#
4650
# option list
4751
#

src/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# TODO: should not use this
22
if (WIN32)
3-
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
4-
53
if (BUILD_SHARED_LIBS)
64
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
75
endif()

0 commit comments

Comments
 (0)