While the opencv_highgui was being built during building of the OpenCV (the lastest version in the github), the following undefined errors occurred.
[ 40%] Linking CXX shared library ..\..\bin\libopencv_highgui400.dll
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN10CvWinModelD1Ev[_ZN10CvWinModelD1Ev]+0x17): undefined reference to `__imp__ZN7QWidgetD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN10CvWinModelD0Ev[_ZN10CvWinModelD0Ev]+0x1e): undefined reference to `__imp__ZN7QWidgetD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$__tcf_2+0xa): undefined reference to `__imp__ZN6QMutexD1Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$__tcf_1+0xa): undefined reference to `__imp__ZN14QWaitConditionD1Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZL16icvFindBarByNameP10QBoxLayout7QString7typeBar.constprop.204+0x37): undefined reference to `__imp__ZeqRK7QStringS1_'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZThn16_N10CvWinModelD1Ev[_ZThn16_N10CvWinModelD1Ev]+0x1c): undefined reference to `__imp__ZN7QWidgetD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZThn16_N10CvWinModelD0Ev[_ZThn16_N10CvWinModelD0Ev]+0x22): undefined reference to `__imp__ZN7QWidgetD2Ev'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x11): undefined reference to `__imp__ZNK20QFutureInterfaceBase10isCanceledEv'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x42): undefined reference to `__imp__ZNK20QFutureInterfaceBase5mutexEv'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x60): undefined reference to `__imp__ZN6QMutex4lockEv'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x6f): undefined reference to `__imp__ZNK20QFutureInterfaceBase10queryStateENS_5StateE'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0x83): undefined reference to `__imp__ZN20QFutureInterfaceBase14reportFinishedEv'
CMakeFiles\opencv_highgui.dir/objects.a(window_QT.cpp.obj):window_QT.cpp:(.text$_ZN12QtConcurrent15RunFunctionTaskIiE3runEv[_ZN12QtConcurrent15RunFunctionTaskIiE3runEv]+0xa8): undefined reference to `__imp__ZN20QFutureInterfaceBase15resultStoreBaseEv'
... (it is very long)
It seems that all the Qt libs were not linked. But I checked that I specified all the paths correctly. I also asked this problem to Qt forum, but it seems that this problem doesn't have something to do with Qt. At least, I hope that I can get any clue to solve this problem.