Skip to content

Cleaning Build dir - option for bein conservative #22

@ikcalB

Description

@ikcalB

TL;DR: add an option for remvoing known files only, not the whole content of the build dir.

I've come to use CMake for embedded systems.
Beeing at the build dir, where all making/flashing/debugging happens, there are cases where one would like to save some FLASH content / EEPROM values / whatever downloaded from the target. (For comparison, reference,...)

It's convenient to have those things in build dir.

What about an option to remove only files, knowingly generated by CMake?
Like so (maybe include files where grepping for 'generated by CMake' or the like):

function! s:cmakeclean()
  if !s:find_build_dir()
    return
  endif

  let s:cmd_clean="rm -r '" . b:build_dir . "'/"
  echo system(s:cmd_clean . "CMakeCache.txt")
  echo system(s:cmd_clean . "CMakeFiles")
  echo system(s:cmd_clean . "cmake_install.cmake")
  echo system(s:cmd_clean . "Makefile")
  echom "Build directory has been cleaned."
endfunction

(only using CMake for Makefiles and linux, this list probably needs to be extended for different build systems)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions