version: build-{build}

os:
    - Visual Studio 2017
    - Visual Studio 2015

init:
    - cmake --version
    - msbuild /version

platform:
    - Win32
    - x64

configuration:
    - Debug

environment:
    ZMQ_VER: 4.2.5

cache:
    - libzmq -> appveyor.yml
    - Build/catch -> tests/cmake/catch.cmake

before_build:
    - if not exist libzmq (
        appveyor DownloadFile https://github.com/zeromq/libzmq/archive/v%ZMQ_VER%.zip &&
        7z x v%ZMQ_VER%.zip >NUL &&
        cmake -H./libzmq-%ZMQ_VER% -Blibzmq-%ZMQ_VER%/build -DCMAKE_INSTALL_PREFIX=libzmq -DENABLE_DRAFTS=ON -DWITH_PERF_TOOL=OFF -DZMQ_BUILD_TESTS=OFF -DENABLE_CPACK=OFF -A%PLATFORM% &&
        cmake --build libzmq-%ZMQ_VER%/build --target install)
    - cmake -H. -BBuild -DENABLE_DRAFTS=ON -DCMAKE_PREFIX_PATH=./libzmq -A%PLATFORM%

build:
    project: Build/cppzmq.sln
    verbosity: normal

test_script:
    - cp libzmq/bin/libzmq*.dll Build/bin/%configuration%/
    - cd Build
    - ctest -V -C %configuration%
