```cmake
macro(addTestTargetToLibavgPythonPackage testTarget)
    add_custom_target(copy_${testTarget} ALL)
    add_dependencies(copy_${testTarget} ${testTarget})
    add_custom_command(TARGET copy_${testTarget}
        COMMAND ${CMAKE_COMMAND} -E copy
        "${CMAKE_CURRENT_BINARY_DIR}/${testTarget}"
        "${CMAKE_BINARY_DIR}/python/libavg/test/cpptest"
        )
endmacro()


macro(addTestDataToLibavgPythonPackage testTarget dataDir)
    add_custom_command(TARGET copy_${testTarget}
        COMMAND ${CMAKE_COMMAND} -E copy_directory
        "${CMAKE_CURRENT_SOURCE_DIR}/${dataDir}"
        "${CMAKE_BINARY_DIR}/python/libavg/test/cpptest/baseline"
        )
endmacro()


macro(addPluginToLibavgPythonPackage plugin)
    add_custom_target(copy_${plugin} ALL)
    add_dependencies(copy_${plugin} ${plugin})
    add_custom_command(TARGET copy_${plugin}
        COMMAND ${CMAKE_COMMAND} -E copy
        "${CMAKE_CURRENT_BINARY_DIR}/${plugin}${CMAKE_SHARED_MODULE_SUFFIX}"
        "${CMAKE_BINARY_DIR}/python/libavg/test/plugin"
        )
endmacro()
```

Use functions instead of macros for better scope control.
user
```cmake
function(addTestTargetToLibavgPythonPackage testTarget)
    add_custom_target(copy_${testTarget} ALL)
    add_dependencies(copy_${testTarget} ${testTarget})
    add_custom_command(TARGET copy_${testTarget}
        COMMAND ${CMAKE_COMMAND} -E copy
        "${CMAKE_CURRENT_BINARY_DIR}/${testTarget}"
        "${CMAKE_BINARY_DIR}/python/libavg/test/cpptest"
        )
endfunction()


function(addTestDataToLibavgPythonPackage testTarget dataDir)
    add_custom_command(TARGET copy_${testTarget}
        COMMAND ${CMAKE_COMMAND} -E copy_directory
        "${CMAKE_CURRENT_SOURCE_DIR}/${dataDir}"
        "${CMAKE_BINARY_DIR}/python/libavg/test/cpptest/baseline"
        )
endfunction()


function(addPluginToLibavgPythonPackage plugin)
    add_custom_target(copy_${plugin} ALL)
    add_dependencies(copy_${plugin} ${plugin})
    add_custom_command(TARGET copy_${plugin}
        COMMAND ${CMAKE_COMMAND} -E copy
        "${CMAKE_CURRENT_BINARY_DIR}/${plugin}${CMAKE_SHARED_MODULE_SUFFIX}"
        "${CMAKE_BINARY_DIR}/python/libavg/test/plugin"
        )
endfunction()
```
assistant