mkdir build
cd build

:: use nmake because vs2008 gets tripped up by $(configuration)
cmake -G "NMake Makefiles" ^
      -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
      -DCMAKE_BUILD_TYPE:STRING=Release ^
      -DBUILD_STATIC:BOOL=OFF ^
      -DPREFER_EXTERNAL_SNAPPY:BOOL=ON ^
      -DPREFER_EXTERNAL_LZ4:BOOL=ON ^
      -DPREFER_EXTERNAL_ZLIB:BOOL=ON ^
      ..\

cmake --build . --config Release
if %ERRORLEVEL% neq 0 exit 1
cmake --build . --target INSTALL --config Release
if %ERRORLEVEL% neq 0 exit 1
ctest -C Release

del %LIBRARY_BIN%\msvc*.dll
del %LIBRARY_BIN%\Microsoft.*
move %LIBRARY_LIB%\blosc.dll %LIBRARY_BIN%\
