From 6c7b42a190ee3242f0c11b75bff6bfab6f401ffc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 6 Oct 2021 15:24:59 -0400 Subject: [PATCH] small tweaks and fixes for compiling with MSVC++ --- cmake/CMakeLists.txt | 4 +++- src/dump.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 3af67bf8e0..4ca978338f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -97,9 +97,11 @@ if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14)) endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Use compiler extensions") -# ugly hack for MSVC which by default always reports an old C++ standard in the __cplusplus macro +# ugly hacks for MSVC which by default always reports an old C++ standard in the __cplusplus macro +# and prints lots of pointless warnings about "unsafe" functions if(MSVC) add_compile_options(/Zc:__cplusplus) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() # export all symbols when building a .dll file on windows diff --git a/src/dump.cpp b/src/dump.cpp index 637ded53d0..7dbe95c1d3 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -196,7 +196,7 @@ Dump::~Dump() if (multifile == 0 && fp != nullptr) { if (compressed) { - if (filewriter) pclose(fp); + if (filewriter) platform::pclose(fp); } else { if (filewriter) fclose(fp); } @@ -518,7 +518,7 @@ void Dump::write() if (multifile) { if (compressed) { - if (filewriter && fp != nullptr) pclose(fp); + if (filewriter && fp != nullptr) platform::pclose(fp); } else { if (filewriter && fp != nullptr) fclose(fp); }