解决方案:
the cause is the google tests is looking for the generic regex.h but cmake used the regex.h from boost. and boost is not linked.
I'm not sure how to fix it properly but renaming /usr/local/include/boost/regex.h temporarily to something else fix the problem.
相关cmake的参数:
-DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_TESTS=OFF -D WITH_OPENMP=ON -DGTEST_HAS_POSIX_RE=0 cmake -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_TESTS=OFF -DGTEST_HAS_POSIX_RE=0 -D WITH_OPENMP=ON -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/vision4/VISION/daisida/opencv-3.4.0 -D WITH_GPHOTO2=OFF -D WITH_GTK=OFF -D WITH_CUDA=OFF -D WITH_FFMPEG=OFF -D WITH_LAPACK=OFF ../