From bef847f2cccc26c0e2284dc4d0d00520bfedab13 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 22 Dec 2023 12:48:14 +0700 Subject: [PATCH 1/2] chore: bump CheckWarning.cmake to version 2.0.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d14ef6..381be32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) # Get all targets in this directory get_property(TARGETS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS) - cpmaddpackage(gh:threeal/CheckWarning.cmake@1.1.0) + cpmaddpackage(gh:threeal/CheckWarning.cmake@2.0.1) foreach(TARGET IN LISTS TARGETS) # Statically analyze code by checking for warnings target_check_warning(${TARGET}) From f5ce93718e81a9f51964149c36c47a43e548b834 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 22 Dec 2023 12:52:01 +0700 Subject: [PATCH 2/2] build: replace `target_check_warning` with `add_check_warning` --- CMakeLists.txt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 381be32..c460386 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,10 @@ target_compile_features(errors PRIVATE cxx_std_20) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) option(BUILD_DOCS "Enable documentations build" OFF) + # Statically analyze code by checking for warnings + cpmaddpackage(gh:threeal/CheckWarning.cmake@2.0.1) + add_check_warning() + # Import Format.cmake to format source code cpmaddpackage( GITHUB_REPOSITORY TheLartians/Format.cmake @@ -51,15 +55,6 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) catch_discover_tests(errors_test) endif() - # Get all targets in this directory - get_property(TARGETS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY BUILDSYSTEM_TARGETS) - - cpmaddpackage(gh:threeal/CheckWarning.cmake@2.0.1) - foreach(TARGET IN LISTS TARGETS) - # Statically analyze code by checking for warnings - target_check_warning(${TARGET}) - endforeach() - # Build XML documentation if(BUILD_DOCS) include(cmake/add_xml_docs.cmake)