8000 Merge pull request #126 from pjohnmeyer/up_msvc_warning_levels · Reification/unittest-cpp@1d0e157 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d0e157

Browse files
authored
Merge pull request unittest-cpp#126 from pjohnmeyer/up_msvc_warning_levels
Up MSVC warning levels
2 parents c431be9 + 7e4fff3 commit 1d0e157

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ option(UTPP_USE_PLUS_SIGN
77
option(UTPP_INCLUDE_TESTS_IN_BUILD
88
"Set this to OFF if you do not wish to automatically build or run unit tests as part of the default cmake --build"
99
ON)
10+
option(UTPP_AMPLIFY_WARNINGS
11+
"Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler"
12+
ON)
1013

1114
if(MSVC14 OR MSVC12)
1215
# has the support we need
@@ -23,6 +26,15 @@ else()
2326
endif()
2427
endif()
2528

29+
# up warning level for project
30+
if (${UTPP_AMPLIFY_WARNINGS})
31+
# instead of getting compiler specific, we're going to try making an assumption that an existing /W# means
32+
# we are dealing with an MSVC or MSVC-like compiler (e.g. Intel on Windows)
33+
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
34+
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
35+
endif()
36+
endif()
37+
2638
# get the main sources
2739
file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.h)
2840
file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.cpp)

UnitTest++/RequiredCheckTestReporter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ namespace UnitTest {
1919
bool Next();
2020

2121
private:
22+
RequiredCheckTestReporter(RequiredCheckTestReporter const&);
23+
RequiredCheckTestReporter& operator =(RequiredCheckTestReporter const&);
24+
2225
TestResults& m_results;
2326
TestReporter* m_originalTestReporter;
2427
ThrowingTestReporter m_throwingReporter;

0 commit comments

Comments
 (0)
0