To capture errors to file, use "command 2> filename".
I guess it can't find dxva2api.h but I'd expect a missing header error instead. I've actually added the include folder to my CFLAGS, CXXFLAGS and CMAKE_INCLUDE_PATH so maybe you need the same. e.g.
export CFLAGS=-I/usr/local/include -I/mingw/x86_64-w64-mingw32/include
export CXXFLAGS=-I/usr/local/include -I/mingw/x86_64-w64-mingw32/include