1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-01-16 01:37:58 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Gabi Melman
f57378d8ba
Update test_eventlog.cpp 2020-03-28 13:59:59 +03:00
Gabi Melman
1ccdc225af
Merge pull request #1495 from trondhe/v1.x
add /WX mscv compiler option for only mscv compiler
2020-03-28 13:30:43 +03:00
Trond H Emaus
3e4df86ac0 create MSVC_OPTIONS list only if compiler is msvc 2020-03-28 10:26:32 +01:00
Trond H Emaus
7054cf7a35 replace MSVC_OPTIONS variable as list 2020-03-28 00:03:59 +01:00
Trond H Emaus
2a7fc9e30e add /WX mscv compiler option for only mscv compiler
clang on windows support both gcc and mscv style options. Clang.exe on windows
defaults to gcc style, which will result in /WX unknown compiler command.
This will set /WX if and only if the compiler is MSVC and greater than version 1900
2020-03-27 19:59:22 +01:00
2 changed files with 11 additions and 6 deletions

View File

@ -28,13 +28,18 @@ endfunction()
# Turn on warnings on the given target
function(spdlog_enable_warnings target_name)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
list(APPEND MSVC_OPTIONS "/W3")
if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015
list(APPEND MSVC_OPTIONS "/WX")
endif()
endif()
target_compile_options(${target_name} PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wconversion -pedantic -Wfatal-errors>
$<$<CXX_COMPILER_ID:MSVC>:/W3>)
if(MSVC_VERSION GREATER 1900) #Allow non fatal security wanrnings for msvc 2015
target_compile_options(${target_name} PRIVATE /WX)
endif()
$<$<CXX_COMPILER_ID:MSVC>:${MSVC_OPTIONS}>)
endfunction()

View File

@ -43,7 +43,7 @@ static void test_single_print(std::function<void(std::string const &)> do_log, s
REQUIRE(record->NumStrings == 1);
REQUIRE(record->EventType == expected_ev_type);
REQUIRE(record->TimeGenerated == expected_time_generated);
REQUIRE((expected_time_generated - record->TimeGenerated) <= 3u);
std::string message_in_log(((char *)record + record->StringOffset));
REQUIRE(message_in_log == expected_contents + spdlog::details::os::default_eol);
@ -68,4 +68,4 @@ TEST_CASE("eventlog", "[eventlog]")
test_single_print([&test_logger](std::string const &msg) { test_logger.critical(msg); }, "my critical message", EVENTLOG_ERROR_TYPE);
}
#endif //_WIN32
#endif //_WIN32