From 0467385010ca03b3178ee2462f2358e55cb30f1f Mon Sep 17 00:00:00 2001 From: Takuya Takeuchi Date: Sun, 15 Jan 2023 23:30:13 +0900 Subject: [PATCH] cmake : configure CMAKE_C_FLAGS and target_link_libraries for MSVC (#15) --- src/CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c398160..da46be3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,8 +18,10 @@ endif() # compiler flags -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=vla") -#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno -ffinite-math-only -funsafe-math-optimizations") +if (NOT MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=vla") + #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-math-errno -ffinite-math-only -funsafe-math-optimizations") +endif() message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}") @@ -63,7 +65,11 @@ target_include_directories(${TARGET} PUBLIC ../include/ggml ) -target_link_libraries(${TARGET} PUBLIC m ${GGML_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) +if (MSVC) + target_link_libraries(${TARGET} PUBLIC ${GGML_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) +else() + target_link_libraries(${TARGET} PUBLIC m ${GGML_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) +endif() if (BUILD_SHARED_LIBS) target_link_libraries(${TARGET} PUBLIC