File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.2)
22
3+ # Link this 'library' to use the following warnings
4+ add_library (project_warnings INTERFACE )
5+
36if (CMAKE_COMPILER_IS_GNUCC)
47 option (ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" FALSE )
58
@@ -9,18 +12,22 @@ if (CMAKE_COMPILER_IS_GNUCC)
912endif ()
1013
1114if (MSVC )
12- add_compile_options ( /W4)
15+ target_compile_options (project_warnings INTERFACE /W4)
1316else ()
14- add_compile_options ( -Wall -Wextra -Wpedantic)
17+ target_compile_options (project_warnings INTERFACE -Wall -Wextra -Wpedantic)
1518endif ()
1619
1720add_executable (intro main.cpp)
1821target_compile_features (intro PRIVATE cxx_lambda_init_captures)
22+ target_link_libraries (intro PRIVATE project_warnings)
23+
1924target_link_libraries (intro --coverage)
2025
2126enable_testing ()
2227
2328add_executable (tester tester.cpp)
29+ target_link_libraries (tester PRIVATE project_warnings)
30+
2431target_link_libraries (tester --coverage)
2532add_test (Tester tester)
2633
You can’t perform that action at this time.
0 commit comments