From 234f414652e85d62706a824c967d5300f7c1304d Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 29 Oct 2022 19:41:50 +0300 Subject: [PATCH] ref #5 : update CMake for Windows build - __AVX2__ should already be defined due to /arch:AVX2 - _CRT_SECURE_NO_WARNINGS should be defined both for shared and static lib --- CMakeLists.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb03af9..7dbc476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,9 +167,11 @@ target_include_directories(${TARGET} PUBLIC ) if (MSVC) - target_link_libraries(${TARGET} PRIVATE ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(${TARGET} PRIVATE ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + + set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -D_CRT_SECURE_NO_WARNINGS) else() - target_link_libraries(${TARGET} PRIVATE m ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(${TARGET} PRIVATE m ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT}) endif() if (BUILD_SHARED_LIBS) @@ -180,10 +182,6 @@ if (BUILD_SHARED_LIBS) target_compile_definitions(${TARGET} PUBLIC WHISPER_SHARED ) - - if (MSVC) - target_compile_definitions(${TARGET} PUBLIC __AVX2__ _CRT_SECURE_NO_WARNINGS) - endif() endif() target_compile_definitions(${TARGET} PUBLIC