obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

cmake/linux: Allow cmake command to disable color diagnostics

Open norihiro opened this issue 5 months ago • 0 comments

Description

Set CACHE option to set CMAKE_COLOR_DIAGNOSTICS = ON so that the variable can be configurable by cmake command.

Motivation and Context

When using :make command on Vim, Vim cannot recognize the file name of the reported errors and warnings because of the escape sequences.

For example, after the build flow, Vim opens a file ^[[01m^[[K/home/user/obs-studio/libobs/util/buffered-file-serializer.c and shows a warning message like below.

(142 of 2641): ^[[m^[[K ^[[01;35m^[[Kwarning: ^[[m^[[K‘^[[01m^[[...e used uninitialized [^[[01;35m^[[K-Wmaybe-uninitialized^[[m^[[K]

How Has This Been Tested?

  1. Go to obs-studio repository.
  2. Configure with cmake cmake -S . -B build -D CMAKE_COLOR_DIAGNOSTICS=OFF (and more options).
  3. Open Vim and set :let &makeprg='cd build && make -j9' to run make in build directory.
  4. Run :make -B command on Vim.
  5. Assuming some warnings or errors are reported, check :cn and :cp commands work.

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

norihiro avatar Aug 26 '24 07:08 norihiro