From: Daniel Bevenius Date: Thu, 1 May 2025 08:05:24 +0000 (+0200) Subject: whisper : add check that target name exists (whisper/3103) X-Git-Tag: upstream/0.0.5318~73 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=99881f77d82efda80b21057d84f1cc2df2f1e0f6;p=pkg%2Fggml%2Fsources%2Fllama.cpp whisper : add check that target name exists (whisper/3103) This commit adds a check to makes sure that the target exists before trying to add compile options to ignore warnings when using MSVC. The motivation for this is currently the build is broken depending on the cmake options provided. With this fix it should be possible to build even if the targets are not actually available. Refs: https://github.com/ggml-org/whisper.cpp/pull/3090#issuecomment-2842760104 --- diff --git a/ggml/CMakeLists.txt b/ggml/CMakeLists.txt index e632af01..b463cbd9 100644 --- a/ggml/CMakeLists.txt +++ b/ggml/CMakeLists.txt @@ -368,10 +368,19 @@ if (MSVC) /wd4267 # Conversion from 'size_t' to a smaller type, possible loss of data ) function(disable_msvc_warnings target_name) - target_compile_options(${target_name} PRIVATE ${MSVC_WARNING_FLAGS}) + if(TARGET ${target_name}) + target_compile_options(${target_name} PRIVATE ${MSVC_WARNING_FLAGS}) + endif() endfunction() disable_msvc_warnings(ggml-base) disable_msvc_warnings(ggml) disable_msvc_warnings(ggml-cpu) + disable_msvc_warnings(ggml-cpu-x64) + disable_msvc_warnings(ggml-cpu-sse42) + disable_msvc_warnings(ggml-cpu-sandybridge) + disable_msvc_warnings(ggml-cpu-haswell) + disable_msvc_warnings(ggml-cpu-skylakex) + disable_msvc_warnings(ggml-cpu-icelake) + disable_msvc_warnings(ggml-cpu-alderlake) endif()