From bc6f1e2469bbe787f08de3baa51a55dceb318daa Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 10 Jun 2019 20:09:39 -0700 Subject: [PATCH] Windows compiler options improvements (#1709) - Use generators to set options only during build - Add ZcThrowingNew - Disable 4996 Fixes #1699 --- shared/config.gradle | 2 +- wpiutil/CMakeLists.txt | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/shared/config.gradle b/shared/config.gradle index 055af89838..fe50f192d6 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -1,7 +1,7 @@ import edu.wpi.first.nativeutils.* import org.gradle.internal.os.OperatingSystem -def windowsCompilerArgs = ['/EHsc', '/D_CRT_SECURE_NO_WARNINGS', '/Zi', '/FS', '/Zc:inline', '/MP4', '/W3', '/wd4244', '/wd4267', '/wd4146', '/std:c++17', '/permissive-', '/WX'] +def windowsCompilerArgs = ['/EHsc', '/D_CRT_SECURE_NO_WARNINGS', '/Zi', '/FS', '/Zc:inline', '/W3', '/wd4244', '/wd4267', '/wd4146', '/wd4996', '/std:c++17', '/Zc:throwingNew', '/permissive-', '/WX'] def windowsCCompilerArgs = ['/Zi', '/FS', '/Zc:inline', '/W3', '/WX'] def windowsReleaseCompilerArgs = ['/O2', '/MD'] def windowsDebugCompilerArgs = ['/Od', '/MDd'] diff --git a/wpiutil/CMakeLists.txt b/wpiutil/CMakeLists.txt index bc09c1c3f6..bcb8d7c76a 100644 --- a/wpiutil/CMakeLists.txt +++ b/wpiutil/CMakeLists.txt @@ -78,9 +78,12 @@ set_target_properties(wpiutil PROPERTIES DEBUG_POSTFIX "d") set_property(TARGET wpiutil PROPERTY FOLDER "libraries") if (NOT MSVC) - target_compile_options(wpiutil PUBLIC -std=c++14 -Wall -pedantic -Wextra -Wno-unused-parameter) + target_compile_options(wpiutil PUBLIC $) + target_compile_features(wpiutil PUBLIC cxx_std_14) else() - target_compile_options(wpiutil PUBLIC /wd4244 /wd4267 /wd4146 /WX /permissive- /std:c++17) + target_compile_options(wpiutil PUBLIC /wd4244 /wd4267 /wd4146) + target_compile_options(wpiutil PUBLIC $) + target_compile_features(wpiutil PUBLIC cxx_std_17) target_compile_options(wpiutil PRIVATE -D_CRT_SECURE_NO_WARNINGS) endif()