From 89c533af1876ca554e85238785ef2a17cf6913b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=95=AD=E6=BE=A7=E9=82=A6?= <45505768+shou692199@users.noreply.github.com> Date: Tue, 22 Oct 2024 00:20:04 +0800 Subject: [PATCH] cmake: exclude math library when generator is Visual Studio Trying to build cpu only variant on Windows when oneAPI environment is active, it will failed by an linker error LNK1104. This commit solved the issue by excluding libm.lib target link also when cmake generator is any version of Visual Studio. --- ggml/src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml/src/CMakeLists.txt b/ggml/src/CMakeLists.txt index aa405e4d0..b4b9dde91 100644 --- a/ggml/src/CMakeLists.txt +++ b/ggml/src/CMakeLists.txt @@ -1400,7 +1400,7 @@ list(APPEND GGML_EXTRA_LIBS_PRIVATE Threads::Threads) find_library(MATH_LIBRARY m) if (MATH_LIBRARY) - if (NOT WIN32 OR NOT GGML_SYCL) + if ((NOT WIN32 OR NOT GGML_SYCL) AND NOT CMAKE_GENERATOR MATCHES "Visual Studio*") list(APPEND GGML_EXTRA_LIBS_PRIVATE m) endif() endif()