anchor.diff:   -DENABLE_LOGGING=%enable_logging%^
    -DBOOST_USE_CXX11=ON^
    -DCMAKE_CONFIGURATION_TYPES="%build_config%"^
  - -DCMAKE_INSTALL_PREFIX:PATH="%DIST_DIR%"
  -
  -cd /d %RIME_ROOT%
  -echo cmake %RIME_ROOT% -B%build_dir% %RIME_CMAKE_FLAGS%
  -call cmake %RIME_ROOT% -B%build_dir% %RIME_CMAKE_FLAGS%
  + -DCMAKE_INSTALL_PREFIX:PATH="%RIME_ROOT%\dist"
  +
  +echo on
  +call cmake . -B%build_dir% %rime_cmake_flags%
  +@echo off
   if errorlevel 1 goto error
   
   echo.
   echo building librime.
  +echo.
  +echo on
   cmake --build %build_dir% --config %build_config% --target INSTALL
  +@echo off
   if errorlevel 1 goto error
  +
  +if "%build_test%" == "ON" (
  +  copy /y dist\lib\rime.dll build\test
  +  pushd build\test
  +  .\Release\rime_test.exe || goto error
  +  popd
  +)
   
   echo.
   echo ready.
  
positive.code:  -DCMAKE_C_FLAGS_RELEASE:STRING="/MT /O2 /Ob2 /DNDEBUG"^
   -DCMAKE_CXX_FLAGS_DEBUG:STRING="/MTd /Od"^
   -DCMAKE_C_FLAGS_DEBUG:STRING="/MTd /Od"^
   -DCMAKE_INSTALL_PREFIX:PATH="%THIRDPARTY%"
  
  if %build_thirdparty% == 1 (
    cd /d %THIRDPARTY%
  
    echo building capnproto.
    cd %THIRDPARTY%\src\capnproto
    cmake . -B%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
  	-DBUILD_SHARED_LIBS:BOOL=OFF^
  	-DBUILD_TESTING:BOOL=OFF
    if errorlevel 1 goto error
    cmake --build %build_dir% --config %build_config% --target INSTALL
    if errorlevel 1 goto error
  
    echo building glog.
    cd %THIRDPARTY%\src\glog
    cmake . -Bcmake-%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
    -DBUILD_SHARED_LIBS:BOOL=OFF^
    -DBUILD_TESTING:BOOL=OFF^
    -DWITH_GFLAGS:BOOL=OFF
    if errorlevel 1 goto error
    cmake --build cmake-%build_dir% --config %build_config% --target INSTALL
    if errorlevel 1 goto error
  
    echo building leveldb.
    cd %THIRDPARTY%\src\leveldb
    cmake . -B%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
    -DLEVELDB_BUILD_BENCHMARKS:BOOL=OFF^
    -DLEVELDB_BUILD_TESTS:BOOL=OFF
    if errorlevel 1 goto error
    cmake --build %build_dir% --config %build_config% --target INSTALL
    if errorlevel 1 goto error
  
    echo building yaml-cpp.
    cd %THIRDPARTY%\src\yaml-cpp
    cmake . -B%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
    -DMSVC_SHARED_RT:BOOL=OFF^
    -DYAML_MSVC_SHARED_RT:BOOL=OFF^
    -DYAML_CPP_BUILD_CONTRIB:BOOL=OFF^
  
negative.code:   if errorlevel 1 goto error
    cmake --build %build_dir% --config %build_config% --target INSTALL
    if errorlevel 1 goto error
    popd
  
    echo building gtest.
    pushd thirdparty\src\googletest
    cmake . -B%build_dir% %thirdparty_common_cmake_flags%^
    -DBUILD_GMOCK:BOOL=OFF
    if errorlevel 1 goto error
    cmake --build %build_dir% --config %build_config% --target INSTALL
    if errorlevel 1 goto error
    popd
  
    echo building marisa.
    pushd thirdparty\src\marisa-trie
    cmake .. -B%build_dir% %thirdparty_common_cmake_flags%
    if errorlevel 1 goto error
    cmake --build %build_dir% --config %build_config% --target INSTALL
    if errorlevel 1 goto error
    popd
  
    echo building opencc.
    pushd thirdparty\src\opencc
    cmake . -B%build_dir% %thirdparty_common_cmake_flags%^
    -DBUILD_SHARED_LIBS=OFF^
    -DBUILD_TESTING=OFF
    if errorlevel 1 goto error
    cmake --build %build_dir% --config %build_config% --target INSTALL
    if errorlevel 1 goto error
    popd
  )
  
  if %build_librime% == 0 goto exit
  
  set rime_cmake_flags=-G%CMAKE_GENERATOR%^
   -A%ARCH%^
   -T%PLATFORM_TOOLSET%^
   -DBUILD_STATIC=ON^
  