Skip to content

[cmake] remove custom CheckCXXCompileFlag.cmake macro - #23218

Open
linev wants to merge 1 commit into
root-project:masterfrom
linev:remove_check_cxx_compiler
Open

[cmake] remove custom CheckCXXCompileFlag.cmake macro#23218
linev wants to merge 1 commit into
root-project:masterfrom
linev:remove_check_cxx_compiler

Conversation

@linev

@linev linev commented Sep 1, 2026

Copy link
Copy Markdown
Member

ROOT was maintain own copy of CheckCXXCompileFlag.cmake from year 2011
Meanwhile cmake 3.20 and higher provides much better version which covers many other compilers with their error output. So there is no reason for maintain our own version

One more reason to remove it - cmake 4.4 produces warning about usage of backslashes in the REGEX.

Some more info from Claude:

for a CMake ≥ 3.20 baseline, the stock module should be functionally equivalent (or better) than ROOT's bundled copy — the original reason for ROOT carrying its own version has effectively been absorbed upstream.

Here's the comparison:

ROOT's custom CheckCXXCompilerFlag.cmake (the version I found) is a 2011-era fork of the old Kitware module. Its whole reason for existing was an extended FAIL_REGEX list to catch compilers that print a warning and exit 0 on a bad flag instead of failing outright — with patterns for GNU, Clang, MSVC, Intel, HP, SunPro, XL/AIX, and PGI.

Stock CMake's module now delegates its regex list to a shared helper, CMakeCheckCompilerFlagCommonPatterns.cmake, included via CHECK_COMPILER_FLAG_COMMON_PATTERNS. That file's pattern set is actually broader than ROOT's own:

ROOT was maintaing own copy of CheckCXXCompileFlag.cmake from year 2011
Meanwhile `cmake` 3.20 and higher provides much better version which
covers many other compilers with their error output.
So reason there is no reason for maintain our own version
@linev linev self-assigned this Sep 1, 2026
@linev
linev requested a review from bellenot as a code owner September 1, 2026 09:16

@guitargeek guitargeek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants