Skip to content

Commit 3d666d5

Browse files
authored
build: check warnings globally (#73)
* chore: bump CheckWarning.cmake to version 2.0.1 * build: replace `target_check_warning` with `add_check_warning`
1 parent 9a57aa0 commit 3d666d5

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

CMakeLists.txt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ target_compile_features(errors PRIVATE cxx_std_20)
1616
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
1717
option(BUILD_DOCS "Enable documentations build" OFF)
1818

19+
# Statically analyze code by checking for warnings
20+
cpmaddpackage(gh:threeal/CheckWarning.cmake@2.0.1)
21+
add_check_warning()
22+
1923
# Import Format.cmake to format source code
2024
cpmaddpackage(
2125
GITHUB_REPOSITORY TheLartians/Format.cmake
@@ -51,15 +55,6 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
5155
catch_discover_tests(errors_test)
5256
endif()
5357

54-
# Get all targets in this directory
55-
get_property(TARGETS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS)
56-
57-
cpmaddpackage(gh:threeal/CheckWarning.cmake@1.1.0)
58-
foreach(TARGET IN LISTS TARGETS)
59-
# Statically analyze code by checking for warnings
60-
target_check_warning(${TARGET})
61-
endforeach()
62-
6358
# Build XML documentation
6459
if(BUILD_DOCS)
6560
include(cmake/add_xml_docs.cmake)

0 commit comments

Comments
 (0)