anchor.diff:    if errorlevel 1 goto error
     cmake --build %build_dir% --config %build_config% --target INSTALL
     if errorlevel 1 goto error
  +  popd
   
     echo building gtest.
  -  cd %THIRDPARTY%\src\googletest
  -  cmake . -B%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
  +  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.
  -  cd %THIRDPARTY%\src\marisa-trie
  -  cmake %THIRDPARTY%\src -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
  +  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.
  -  cd %THIRDPARTY%\src\opencc
  -  cmake . -B%build_dir% %THIRDPARTY_COMMON_CMAKE_FLAGS%^
  +  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%^
  +set rime_cmake_flags=-G%CMAKE_GENERATOR%^
    -A%ARCH%^
    -T%PLATFORM_TOOLSET%^
    -DBUILD_STATIC=ON^
  
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: rem Maintainer: Chen Gong <chen.sst@gmail.com>
  
  setlocal
  
  if not exist env.bat copy env.bat.template env.bat
  
  