Use modern cmake approach for flags. Fixed VS2015 warning

This commit is contained in:
James Moore 2020-01-24 07:41:37 +00:00
parent 1a23a9fd4a
commit 77a074c5be
2 changed files with 6 additions and 6 deletions

View File

@ -148,12 +148,10 @@ foreach(file ${files})
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-deprecated;-Wno-float-equal>
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
)
# Force to compile with highest warning level and treat warnings as errors
if(MSVC)
target_compile_options(${testcase} PRIVATE /W4 /WX)
else()
target_compile_options(${testcase} PRIVATE -Wall -Wextra -pedantic -Werror)
endif()
target_compile_options(${testcase} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4;/WX>>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall;-Wextra;-pedantic;-Werror>>
)
target_include_directories(${testcase} PRIVATE
thirdparty/doctest
thirdparty/fifo_map

View File

@ -98,6 +98,8 @@ struct my_allocator : std::allocator<T>
{
if (next_deallocate_fails)
{
(void)p; // Ignored unused
(void)n; // ignored unused
next_deallocate_fails = false;
throw std::bad_alloc();
}