From 3f7e52b216984d27a09036e3abf8104d47827a1b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 30 Aug 2019 10:42:05 -0400 Subject: [PATCH] CMakeLists: Enable extra standards conformance flags on MSVC These flags are off by default. We can enable these to enforce more standards-compliant behavior. Given this project is quite small, this is trivial to append. --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e485d27..537c63b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,25 @@ add_library(kabufuda STATIC ) if(WIN32) + if (MSVC) + target_compile_options(kabufuda PRIVATE + # Enforce various standards compliant behavior. + /permissive- + + # Enable standard volatile semantics. + /volatile:iso + + # Reports the proper value for the __cplusplus preprocessor macro. + /Zc:__cplusplus + + # Allow constexpr variables to have explicit external linkage. + /Zc:externConstexpr + + # Assume that new throws exceptions, allowing better code generation. + /Zc:throwingNew + ) + endif() + target_sources(kabufuda PRIVATE include/kabufuda/winsupport.hpp lib/kabufuda/AsyncIOWin32.cpp