Skip to content

Commit cd506a3

Browse files
committed
Display alll warning during build
Issue #18
1 parent 7844947 commit cd506a3

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
### Added
99
- [Issue #17](https://github.com/suikan4github/template_application/issues/17) : Add gcovr support.
1010
### Changed
11+
- [Issue #18](https://github.com/suikan4github/template_application/issues/18) : Display alll warning during build
1112
### Fixed
1213

1314
## [1.2.0] - 2022-01-02

src/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ file(GLOB ALL_SRCS "*.cpp")
1010

1111
add_executable(${EXECUTABLE_NAME} ${ALL_SRCS})
1212

13-
# Add pthread library to support std::thread
14-
# In the case of MSVC, this is not required.
15-
if (NOT(MSVC))
16-
target_link_libraries(${EXECUTABLE_NAME} "pthread")
17-
endif(NOT(MSVC))
13+
# Add pthread library to support std::thread
14+
# In the case of MSVC, this is not required.
15+
if (NOT(MSVC))
16+
target_link_libraries(${EXECUTABLE_NAME} "pthread")
17+
endif(NOT(MSVC))
1818

test/CMakeLists.txt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,22 @@ set(TEST_EXECUTABLE_NAME test_${PROJECT_NAME})
1919
# Add the executable for the testcase which is using googletest
2020
add_executable(${TEST_EXECUTABLE_NAME} ${TEST_SRC} ${LIB_SRC})
2121

22-
# Add the library under test.
23-
target_link_libraries(${TEST_EXECUTABLE_NAME}
24-
"gtest_main"
25-
)
26-
# Add the include directory for test executable.
27-
target_include_directories(${TEST_EXECUTABLE_NAME}
28-
PUBLIC
29-
"${CMAKE_CURRENT_SOURCE_DIR}/../src"
22+
# Add the library under test.
23+
target_link_libraries(${TEST_EXECUTABLE_NAME}
24+
"gtest_main"
3025
)
26+
# Add the include directory for test executable.
27+
target_include_directories(${TEST_EXECUTABLE_NAME}
28+
PUBLIC
29+
"${CMAKE_CURRENT_SOURCE_DIR}/../src"
30+
)
31+
if(MSVC)
32+
target_compile_options(${TEST_EXECUTABLE_NAME} PRIVATE /W4 )
33+
else()
34+
target_compile_options(${TEST_EXECUTABLE_NAME} PRIVATE -Wall -Wextra -pedantic )
35+
endif()
36+
37+
3138

3239
# Find and integrate the Google Test package
3340

test/test_calc_death.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
// Read GoogleTest document https://github.com/google/googletest/blob/main/docs/advanced.md#death-test-naming
88
TEST(CalcDeathTest, SqrtWithMinusParam)
99
{
10-
Calc calc;
11-
1210
#ifndef NDEBUG
11+
Calc calc;
1312
// We test only when assert() works.
1413
ASSERT_DEATH(calc.sqrt(-1), "param >= 0");
1514
#endif

0 commit comments

Comments
 (0)