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.
This commit is contained in:
蕭澧邦 2024-10-22 00:20:04 +08:00 committed by GitHub
parent f594bc80ba
commit 89c533af18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1400,7 +1400,7 @@ list(APPEND GGML_EXTRA_LIBS_PRIVATE Threads::Threads)
find_library(MATH_LIBRARY m) find_library(MATH_LIBRARY m)
if (MATH_LIBRARY) 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) list(APPEND GGML_EXTRA_LIBS_PRIVATE m)
endif() endif()
endif() endif()