From f7854ed68534577368980846d86b339107b4ce78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Sch=C3=BCmann?= Date: Sun, 4 Nov 2018 14:30:36 +0100 Subject: [PATCH] Fixes for warnings under VS2017. --- filesystem.h | 2 +- test/CMakeLists.txt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/filesystem.h b/filesystem.h index 250ad0f..c706fce 100644 --- a/filesystem.h +++ b/filesystem.h @@ -1669,7 +1669,7 @@ inline u8arguments::u8arguments(int& argc, char**& argv) p = ::CommandLineToArgvW(::GetCommandLineW(), &argc); _args.reserve(argc); _argp.reserve(argc); - for (size_t i = 0; i < argc; ++i) { + for (size_t i = 0; i < static_cast(argc); ++i) { _args.push_back(detail::toUtf8(std::wstring(p[i]))); _argp.push_back((char*)_args[i].data()); } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 77b8aa4..b3a0c6f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,8 @@ add_executable(filesystem_test filesystem_test.cpp ../filesystem.h catch.hpp) +if(CMAKE_CXX_COMPILER_ID MATCHES MSVC) + target_compile_definitions(filesystem_test PRIVATE _CRT_SECURE_NO_WARNINGS) +endif() if(CMAKE_GENERATOR STREQUAL Xcode) add_executable(filesystem_test_cov filesystem_test.cpp ../filesystem.h catch.hpp) target_compile_options(filesystem_test_cov PRIVATE "$<$:--coverage>") @@ -26,5 +29,5 @@ if(CMAKE_CXX_COMPILER_ID MATCHES MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQ add_executable(std_filesystem_test filesystem_test.cpp ../filesystem.h catch.hpp) set_property(TARGET std_filesystem_test PROPERTY CXX_STANDARD 17) target_compile_options(std_filesystem_test PRIVATE "/Zc:__cplusplus") - target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS) + target_compile_definitions(std_filesystem_test PRIVATE USE_STD_FS _CRT_SECURE_NO_WARNINGS) endif()