Skip to content

Support Clang variants (including AppleClang) for cmake builds#586

Open
toptobes wants to merge 1 commit into
apache:trunkfrom
toptobes:clang-variants-support
Open

Support Clang variants (including AppleClang) for cmake builds#586
toptobes wants to merge 1 commit into
apache:trunkfrom
toptobes:clang-variants-support

Conversation

@toptobes

@toptobes toptobes commented Jun 18, 2026

Copy link
Copy Markdown

With CMake 3.0, AppleClang is now a separate compiler target which needs to be explicitly accounted for to allow the driver to easily be built on Mac, and as per further discussion with Brett, we've decided to allow all clang variants here using "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$", and if any of them end up having any unfortunate issues with flag compatibility, we can deal with them on a case-by-case basis

Build succeeds on

Apple clang version 17.0.0 (clang-1700.0.13.5)
Target: arm64-apple-darwin24.6.0

@absurdfarce

Copy link
Copy Markdown
Contributor

Note: this is a fix for CASSCPP-2

Kicked off a Jenkins run just to make sure there isn't some weird regression here (but I'm not expecting anything).

@absurdfarce absurdfarce requested review from Copilot and yifan-c July 14, 2026 22:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CMake compiler detection logic to treat all Clang-family compiler IDs (including AppleClang) as “Clang” for the purposes of enabling Clang-specific flags and feature checks, improving build support on macOS and other Clang variants.

Changes:

  • Switched CMAKE_CXX_COMPILER_ID checks from STREQUAL "Clang" to MATCHES "Clang$" in the top-level CMake logic.
  • Applied the same Clang-variant matching in src/CMakeLists.txt so warning/-Werror flags are consistently enabled for AppleClang and other Clang variants.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
CMakeLists.txt Broadens Clang detection to include all *Clang compiler IDs for atomics selection and top-level compiler flags.
src/CMakeLists.txt Broadens Clang detection to include all *Clang compiler IDs for Clang-specific warning flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CMakeLists.txt

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# Clang/Intel specific compiler options

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.

I mean, I guess... but this seems far from necessary to me

@absurdfarce

Copy link
Copy Markdown
Contributor

This is the second time now that I've accidentally triggered a Copilot review... I think I'm hitting one of the reviewer buttons (with Copilot selected as a default) thinking I can then select my reviewer and then realizing I've just asked Copilot to review A Thing ™️.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants