include(FetchContent) FetchContent_Declare(files_webp URL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.6.0.tar.gz URL_HASH SHA256=e4ab7009bf0629fd11982d4c2aa83964cf244cffba7347ecd39019a9e38c4564 DOWNLOAD_EXTRACT_TIMESTAMP FALSE SOURCE_SUBDIR kswitcher-download-only) FetchContent_MakeAvailable(files_webp) function(build_files_webp) set(BUILD_SHARED_LIBS OFF) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") foreach(component IN ITEMS ANIM_UTILS CWEBP DWEBP GIF2WEBP IMG2WEBP VWEBP WEBPINFO LIBWEBPMUX WEBPMUX EXTRAS) set(WEBP_BUILD_${component} OFF) endforeach() add_subdirectory("${files_webp_SOURCE_DIR}" "${files_webp_BINARY_DIR}" EXCLUDE_FROM_ALL) endfunction() build_files_webp() add_library(KSwitcherFilesImage STATIC src/files_image_decode.cpp src/files_image_view.cpp) target_compile_definitions(KSwitcherFilesImage PRIVATE NOMINMAX UNICODE _UNICODE _WIN32_WINNT=0x0A00) target_link_libraries(KSwitcherFilesImage PRIVATE webpdemux windowscodecs msimg32 ole32) if(MSVC) set_property(TARGET KSwitcherFilesImage PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") target_compile_options(KSwitcherFilesImage PRIVATE /utf-8) endif()