From 84d4f959db5aab6f82a1399bb62120d3d5b22c9f Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Wed, 29 Jan 2020 21:31:20 +0100 Subject: [PATCH] Problem: no CI with VS2019 or any VS with C++11/14/17 mode, build broken in C++17 mode Solution: add CI configuration and fix active_poller.cpp --- appveyor.yml | 1 + tests/CMakeLists.txt | 4 ++++ tests/active_poller.cpp | 2 ++ zmq.hpp | 10 ++++++---- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 07f8e93..f9f1973 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,7 @@ version: build-{build} os: + - Visual Studio 2019 - Visual Studio 2017 - Visual Studio 2015 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 41879aa..6299a05 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,8 +29,12 @@ add_executable( send_multipart.cpp monitor.cpp utilities.cpp + ../zmq.hpp + ../zmq_addon.hpp ) +set_property(TARGET unit_tests PROPERTY CXX_STANDARD 17) + add_dependencies(unit_tests catch) target_include_directories(unit_tests PUBLIC ${CATCH_MODULE_PATH}) diff --git a/tests/active_poller.cpp b/tests/active_poller.cpp index df087db..075896a 100644 --- a/tests/active_poller.cpp +++ b/tests/active_poller.cpp @@ -158,6 +158,8 @@ namespace { struct server_client_setup : common_server_client_setup { + using common_server_client_setup::common_server_client_setup; + zmq::active_poller_t::handler_type handler = [&](zmq::event_flags e) { events = e; diff --git a/zmq.hpp b/zmq.hpp index 03327ff..43936b5 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -33,13 +33,15 @@ #endif #if (defined(__cplusplus) && __cplusplus >= 201402L) \ || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) \ - || (defined(_HAS_CXX17) \ - && _HAS_CXX17 \ - == 1) // _HAS_CXX14 might not be defined when using C++17 on MSVC + || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) \ + || (defined(_MSVC_LANG) \ + && _MSVC_LANG \ + >= 201402L) // _HAS_CXX14 might not be defined when using C++17 on MSVC #define ZMQ_CPP14 #endif #if (defined(__cplusplus) && __cplusplus >= 201703L) \ - || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) + || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) \ + || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) #define ZMQ_CPP17 #endif