Skip to content

cmake: fix compile warnings for clang-cl - #15337

Closed
zjyhjqs wants to merge 3 commits into
curl:masterfrom
zjyhjqs:fix/clang-cl
Closed

cmake: fix compile warnings for clang-cl#15337
zjyhjqs wants to merge 3 commits into
curl:masterfrom
zjyhjqs:fix/clang-cl

Conversation

@zjyhjqs

@zjyhjqs zjyhjqs commented Oct 19, 2024

Copy link
Copy Markdown
Contributor

clang-cl is an alternative command-line interface to Clang, designed for compatibility with the Visual C++ compiler, cl.exe.

The way to test clang-cl in CMake:

  • CMAKE_<LANGUAGE>_COMPILER_ID: "Clang"
  • CMAKE_<LANGUAGE>_COMPILER_FRONTEND_VARIANT: "MSVC"

Note: CMAKE_<LANGUAGE>_COMPILER_FRONTEND_VARIANT) was introduced since CMake 3.14, but the variable MSVC works fine here.


To pass the GNU style compile options to cl frontend, prefix /clang: or -Xclang is required to be prepended.

COMPILE_OPTIONS here is easier to be transformed, because it is a list, not like CMAKE_<LANG>_FLAGS is just a string.

@dfandrich

Copy link
Copy Markdown
Contributor

Analysis of PR #15337 at 0019d285:

Test 987 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them).

Generated by Testclutch

Comment thread CMake/PickyWarnings.cmake Outdated
@vszakats vszakats added the Windows Windows-specific label Oct 19, 2024
@vszakats vszakats changed the title Fix compile warnings for clang-cl cmake: fix compile warnings for clang-cl Oct 19, 2024
@vszakats vszakats closed this in e89491e Oct 21, 2024
@vszakats

Copy link
Copy Markdown
Member

Thanks @zjyhjqs!

vszakats added a commit that referenced this pull request Oct 24, 2024
- use CMake 3.12 syntax when available, in clang-cl branch.
  Follow-up to e89491e #15337

- rename internal variables to underscore-lowercase.
  Follow-up to d8de480 #14571

- update comment.

Closes #15404
vszakats added a commit to vszakats/curl that referenced this pull request Oct 25, 2024
vszakats added a commit that referenced this pull request Oct 25, 2024
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
clang-cl is an alternative command-line interface to Clang, designed
for compatibility with the Visual C++ compiler, `cl.exe`:
https://clang.llvm.org/docs/UsersManual.html#clang-cl

The way to test clang-cl in CMake:
- `CMAKE_<LANGUAGE>_COMPILER_ID`: "Clang"
- `CMAKE_<LANGUAGE>_COMPILER_FRONTEND_VARIANT`: "MSVC"

Note: `CMAKE_<LANGUAGE>_COMPILER_FRONTEND_VARIANT` was introduced since
CMake 3.14, but the variable `MSVC` works fine here.

https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_FRONTEND_VARIANT.html
https://cmake.org/cmake/help/latest/variable/MSVC.html

Closes curl#15337
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
- use CMake 3.12 syntax when available, in clang-cl branch.
  Follow-up to e89491e curl#15337

- rename internal variables to underscore-lowercase.
  Follow-up to d8de480 curl#14571

- update comment.

Closes curl#15404
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants