@@ -361,26 +361,28 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ggml-config.cmake
361
361
${CMAKE_CURRENT_BINARY_DIR} /ggml-version.cmake
362
362
DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/ggml )
363
363
364
- set (MSVC_WARNING_FLAGS
365
- /wd4005 # Macro redefinition
366
- /wd4244 # Conversion from one type to another type, possible loss of data
367
- /wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data
368
- /wd4996 # Disable POSIX deprecation warnings
369
- /wd4702 # Unreachable code warnings
370
- )
371
- function (disable_msvc_warnings target_name )
372
- if (TARGET ${target_name} )
373
- target_compile_options (${target_name} PRIVATE ${MSVC_WARNING_FLAGS} )
374
- endif ()
375
- endfunction ()
376
-
377
- disable_msvc_warnings (ggml-base )
378
- disable_msvc_warnings (ggml )
379
- disable_msvc_warnings (ggml-cpu )
380
- disable_msvc_warnings (ggml-cpu-x64 )
381
- disable_msvc_warnings (ggml-cpu-sse42 )
382
- disable_msvc_warnings (ggml-cpu-sandybridge )
383
- disable_msvc_warnings (ggml-cpu-haswell )
384
- disable_msvc_warnings (ggml-cpu-skylakex )
385
- disable_msvc_warnings (ggml-cpu-icelake )
386
- disable_msvc_warnings (ggml-cpu-alderlake )
364
+ if (MSVC )
365
+ set (MSVC_WARNING_FLAGS
366
+ /wd4005 # Macro redefinition
367
+ /wd4244 # Conversion from one type to another type, possible loss of data
368
+ /wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data
369
+ /wd4996 # Disable POSIX deprecation warnings
370
+ /wd4702 # Unreachable code warnings
371
+ )
372
+ function (disable_msvc_warnings target_name )
373
+ if (TARGET ${target_name} )
374
+ target_compile_options (${target_name} PRIVATE ${MSVC_WARNING_FLAGS} )
375
+ endif ()
376
+ endfunction ()
377
+
378
+ disable_msvc_warnings (ggml-base )
379
+ disable_msvc_warnings (ggml )
380
+ disable_msvc_warnings (ggml-cpu )
381
+ disable_msvc_warnings (ggml-cpu-x64 )
382
+ disable_msvc_warnings (ggml-cpu-sse42 )
383
+ disable_msvc_warnings (ggml-cpu-sandybridge )
384
+ disable_msvc_warnings (ggml-cpu-haswell )
385
+ disable_msvc_warnings (ggml-cpu-skylakex )
386
+ disable_msvc_warnings (ggml-cpu-icelake )
387
+ disable_msvc_warnings (ggml-cpu-alderlake )
388
+ endif ()
0 commit comments