From 37af46bb4c351c69376f9c2947b7c3862014ee41 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 30 Jun 2022 14:10:05 +0200 Subject: feat(build): add_glob_target runs only on changed files #19070 The general idea is that add_glob_targets creates a "touch file", a dummy file that acts as a dependency in order to check which files are outdated since the last time the target was run. Remove RunUncrustify.cmake as it's no longer necessary. It was initially introduced to silence its noisy output. The per-file targets will suppress the noisy output from uncrustify, except for the very first run. Also remove DefCmdTarget.cmake since add_glob_target already incorporates its functionality. --- src/nvim/CMakeLists.txt | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index a6c4bafc78..a0b8f16a39 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -1,7 +1,5 @@ option(USE_GCOV "Enable gcov support" OFF) -include(DefCmdTarget) - if(USE_GCOV) if(CLANG_TSAN) # GCOV and TSAN results in false data race reports @@ -24,7 +22,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -framework CoreServices") endif() -set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches) set(GENERATOR_DIR ${CMAKE_CURRENT_LIST_DIR}/generators) set(GENERATED_DIR ${PROJECT_BINARY_DIR}/src/nvim/auto) set(BINARY_LIB_DIR ${PROJECT_BINARY_DIR}/lib/nvim/) @@ -800,16 +797,12 @@ foreach(sfile ${LINT_NVIM_SOURCES}) endforeach() add_custom_target(lintc DEPENDS ${LINT_TARGETS}) -def_cmd_target(lintuncrustify ${UNCRUSTIFY_PRG} UNCRUSTIFY_PRG false) -if(UNCRUSTIFY_PRG) - add_custom_command(TARGET lintuncrustify - COMMAND ${CMAKE_COMMAND} - -D UNCRUSTIFY_PRG=${UNCRUSTIFY_PRG} - -D PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} - -D NVIM_SOURCES="${NVIM_SOURCES}" - -D NVIM_HEADERS="${NVIM_HEADERS}" - -P ${PROJECT_SOURCE_DIR}/cmake/RunUncrustify.cmake) -endif() +add_glob_targets( + TARGET lintuncrustify + COMMAND ${UNCRUSTIFY_PRG} + FLAGS -c "${PROJECT_SOURCE_DIR}/src/uncrustify.cfg" -q --check + FILES ${LINT_NVIM_SOURCES} + ) add_custom_target( lintcfull -- cgit