anchor.diff:   -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%"
  + -DCMAKE_INSTALL_PREFIX:PATH="%RIME_ROOT%\thirdparty"
   
   if %build_thirdparty% == 1 (
  -  cd /d %THIRDPARTY%
  -
     echo building capnproto.
  -  cd %THIRDPARTY%\src\capnproto
  -  cmake . -B%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
  +  pushd 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
  +  popd
   
     echo building glog.
  -  cd %THIRDPARTY%\src\glog
  -  cmake . -Bcmake-%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
  +  pushd 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
  +  popd
   
     echo building leveldb.
  -  cd %THIRDPARTY%\src\leveldb
  -  cmake . -B%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
  +  pushd 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
  +  popd
   
     echo building yaml-cpp.
  -  cd %THIRDPARTY%\src\yaml-cpp
  -  cmake . -B%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
  +  pushd 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^
  
positive.code: rem Maintainer: Chen Gong <chen.sst@gmail.com>
  
  setlocal
  set BACK=%CD%
  
  if not exist env.bat copy env.bat.template env.bat
  
  
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^
  