Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,806
    • Issues 3,806
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Merge requests
  • !6747

Closed
Created Nov 19, 2021 by Semyon Kolton@semyon.koltonContributor
  • Report abuse
Report abuse

Introduce `CMAKE_COLOR_DIAGNOSTICS` and `CMAKE_COMPILER_COLOR_DIAGNOSTICS` variables

  • Overview 50
  • Commits 2
  • Pipelines 4
  • Changes 10

This merge request tries to solve the issue #15502 (closed). See #15502 (comment 1083527) It introduces 2 new CMake variables:

  • CMAKE_COMPILER_COLOR_DIAGNOSTICS. This variable controls whether CMake should enable colored compiler diagnostics via compiler flags. It has 3 states: ON/OFF/not defined. ON will force colored diagnostics (-fcolor-diagnostics). OFF will disable colored diagnostics (-fno-color-diagnostics). If the variable is not defined - then CMake will not pass anything and default behavior will be used. By default, this variable is ON for Ninja generators and not defined for other cases.
  • CMAKE_COLOR_DIAGNOSTICS. This variable controls all colored diagnostics in CMake. When ON it will force CMAKE_COMPILER_COLOR_DIAGNOSTICS and CMAKE_COLOR_MAKEFILE to ON. When OFF it does nothing. By default, it's OFF.

This MR consists of 2 commits. First introduce CMAKE_COMPILER_COLOR_DIAGNOSTICS and second introduces CMAKE_COLOR_DIAGNOSTICS. These are dependent commits, so I was unable to create separate MRs for each of them. However, I consider them as solving separate issues. Variable CMAKE_COMPILER_COLOR_DIAGNOSTICS solve actual issue at hand - no colored diagnostics for CMake. I consider this to be a more critical issue. While the second variable CMAKE_COLOR_DIAGNOSTICS is more of a quality of life variable needed for easier configuration for users.

Fixes: #15502 (closed)

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: colored_diagnostics