Skip to content

Commit

Permalink
Fix Clang-tidy error due to declarations in Colvars headers for code …
Browse files Browse the repository at this point in the history
…not used in GROMACS

Attempt at solving https://gitlab.com/gromacs/gromacs/-/merge_requests/3671#note_1637345339

This change extends the same treatment used in `admin/clang-tidy.sh` to the CMake recipe.
  • Loading branch information
giacomofiorin authored and lundborgmagnus committed Nov 8, 2023
1 parent 2ae04a4 commit 11bd2a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/gromacs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif()

if (GMX_CLANG_TIDY)
# Temporarily exclude Colvars headers to silence warnings from code that is not built with GROMACS
# TODO: remove this when clang-tidy >= 14 is used
set_target_properties(libgromacs PROPERTIES CXX_CLANG_TIDY
"${CLANG_TIDY_EXE};-warnings-as-errors=*")
"${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=^(?!.*src/external/colvars).*")
endif()

# TODO: Stop installing libgromacs. Possibly allow installation during deprecation period with GMX_INSTALL_LEGACY_API.
Expand Down
4 changes: 2 additions & 2 deletions src/testutils/TestMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function (gmx_add_unit_test_library NAME)
endif()
if(GMX_CLANG_TIDY)
set_target_properties(${NAME} PROPERTIES CXX_CLANG_TIDY
"${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=.*")
"${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=^(?!.*src/external/colvars).*")
endif()
gmx_warn_on_everything(${NAME})
if (HAS_WARNING_EVERYTHING)
Expand Down Expand Up @@ -235,7 +235,7 @@ function (gmx_add_gtest_executable EXENAME)

if(GMX_CLANG_TIDY)
set_target_properties(${EXENAME} PROPERTIES CXX_CLANG_TIDY
"${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=.*")
"${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=^(?!.*src/external/colvars).*")
endif()
gmx_warn_on_everything(${EXENAME})
if (HAS_WARNING_EVERYTHING)
Expand Down

0 comments on commit 11bd2a8

Please sign in to comment.