Commit 2ef930dd authored by Gallacchi Mattia's avatar Gallacchi Mattia
Browse files

Remove unix test from windows build

parent 9563d688
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.20)

set(_COPY_DLL_DIR "${CMAKE_CURRENT_LIST_DIR}")
set(_MCP2221A_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "MCP2221A library directory")

# Function to copy the MCP2221 DLL to the target directory after build
function(copy_runtime_dll target)
    if(WIN32)

        set(_dll_path "${_MCP2221A_CMAKE_DIR}/MCP2221_DLL/unmanaged/dll/mcp2221_dll_um_x64.dll")
        # Make sure backslashes are converted to forward slashes for Windows
        file(TO_CMAKE_PATH "${_dll_path}" _dll_path_normalized)
        
        add_custom_command(TARGET ${target} POST_BUILD
            COMMAND ${CMAKE_COMMAND} -E copy_if_different
                "${_COPY_DLL_DIR}/MCP2221_DLL/unmanaged/dll/mcp2221_dll_um_x64.dll"
                "${_dll_path_normalized}"
                $<TARGET_FILE_DIR:${target}>
            COMMENT "Copying MCP2221 DLL to output directory"
        )
+4 −2
Original line number Diff line number Diff line
@@ -12,5 +12,7 @@ add_executable(i2c_scan i2c_scan.cpp)
target_link_libraries(i2c_scan PRIVATE mcp2221a)
copy_runtime_dll(i2c_scan)

if (UNIX)
    add_executable(hid_test hid_test.cpp)
    target_link_libraries(hid_test PRIVATE mcp2221a)
endif()
 No newline at end of file