From 0dce223341d45a3fb2b899fbfe05baf8b760aa7e Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Wed, 30 May 2018 22:03:19 +0200 Subject: [PATCH] Problem: no check if noexcept is supported by compiler Solution: add compile check --- CMakeLists.txt | 1 + builds/cmake/Modules/ZMQSourceRunChecks.cmake | 18 ++++++++++++++++++ builds/cmake/platform.hpp.in | 2 ++ 3 files changed, 21 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c754976..082bce5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -415,6 +415,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "SunOS" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD") endif () endif () +zmq_check_noexcept () #----------------------------------------------------------------------------- if (NOT CMAKE_CROSSCOMPILING AND NOT MSVC) diff --git a/builds/cmake/Modules/ZMQSourceRunChecks.cmake b/builds/cmake/Modules/ZMQSourceRunChecks.cmake index 78cedbea..47653a6d 100644 --- a/builds/cmake/Modules/ZMQSourceRunChecks.cmake +++ b/builds/cmake/Modules/ZMQSourceRunChecks.cmake @@ -293,3 +293,21 @@ int main (int argc, char *argv []) " ZMQ_HAVE_GETRANDOM) endmacro() + +macro(zmq_check_noexcept) + message(STATUS "Checking whether noexcept is supported") + check_cxx_source_compiles( +" +struct X +{ + X(int i) noexcept {} +}; + +int main(int argc, char *argv []) +{ + X x(5); + return 0; +} +" + ZMQ_HAVE_NOEXCEPT) +endmacro() diff --git a/builds/cmake/platform.hpp.in b/builds/cmake/platform.hpp.in index 8c8e6cf2..4a910423 100644 --- a/builds/cmake/platform.hpp.in +++ b/builds/cmake/platform.hpp.in @@ -19,6 +19,8 @@ #cmakedefine HAVE_MKDTEMP #cmakedefine ZMQ_HAVE_UIO +#cmakedefine ZMQ_HAVE_NOEXCEPT + #cmakedefine ZMQ_HAVE_EVENTFD #cmakedefine ZMQ_HAVE_EVENTFD_CLOEXEC #cmakedefine ZMQ_HAVE_IFADDRS