Commit 1c70c313 authored by Gallacchi Mattia's avatar Gallacchi Mattia
Browse files

Fix dll copy

parent b045e655
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.20)

set(_COPY_DLL_DIR "${CMAKE_CURRENT_LIST_DIR}")

# Function to copy the MCP2221 DLL to the target directory after build
function(copy_runtime_dll target)
    if(WIN32)
        add_custom_command(TARGET ${target} POST_BUILD
            COMMAND ${CMAKE_COMMAND} -E copy_if_different
                "${CMAKE_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll/mcp2221_dll_um_x64.dll"
                "${_COPY_DLL_DIR}/MCP2221_DLL/unmanaged/dll/mcp2221_dll_um_x64.dll"
                $<TARGET_FILE_DIR:${target}>
            COMMENT "Copying MCP2221 DLL to output directory"
        )