1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-16 12:10:31 +00:00
conky/cmake/clang-tidy.cmake
Tin Švagelj 5ee7bd1185
Add compiler cache and fix CMake deprecation warnings (#2132)
- Fix use of deprecated `exec_program`.
- Reformat 'UninstallConky.cmake.in' file.
- Separate BUILD_TESTS (now BUILD_TESTING to shadow CTest variable) from
  MAINTAINER_MODE flag.
  - Remove BUILD_TESTS flag from CI, default it already true.
- Add support for (s)ccache, enable it by default.
- Add REPRODUCIBLE_BUILD to disable (s)ccache default.
  - Set REPRODUCIBLE_BUILD=ON in nix flake.
- Add sccache to CI.
- Add CI detection for possible future use, stored in ENV_IS_CI variable.
- Minor formatting tweaks.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
2025-01-05 05:37:03 +00:00

28 lines
1.1 KiB
CMake

get_target_property(ClangTidy_SRCS_TMP conky SOURCES)
get_target_property(conky_SRC_DIR conky SOURCE_DIR)
if(BUILD_TESTING)
get_target_property(ClangTidy_SRCS_TMP_CORE conky_core SOURCES)
list(APPEND ClangTidy_SRCS_TMP ${ClangTidy_SRCS_TMP_CORE})
endif()
foreach(TMP_SRC ${ClangTidy_SRCS_TMP})
if("${TMP_SRC}" MATCHES ".*\.cc|.*\.hh|.*\.[chi]pp|.*\.[chi]xx|.*\.ii")
list(APPEND ClangTidy_SRCS ${conky_SRC_DIR}/${TMP_SRC})
endif()
endforeach(TMP_SRC)
get_target_property(CLANG_INCLUDES_tmp conky INCLUDE_DIRECTORIES)
foreach(TMP_INCLUDE ${CLANG_INCLUDES_tmp})
list(APPEND CLANG_INCLUDES -I${TMP_INCLUDE})
endforeach(TMP_INCLUDE)
add_custom_target(clang-tidy
COMMAND ${ClangTidy_BIN} -config='' -fix -format-style=file
${ClangTidy_SRCS}
-- -std=c++17 -I${CMAKE_BINARY_DIR} ${CLANG_INCLUDES})
add_custom_target(check-clang-tidy
COMMAND ${ClangTidy_BIN} -config='' -format-style=file
${ClangTidy_SRCS}
-- -std=c++17 -I${CMAKE_BINARY_DIR} ${CLANG_INCLUDES})