Failed to build on Clang/Windows: `W4` and `WX` flags passed to Clang
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- cmake, cpp
- Domain
- build-system
Research direction
Start in CMake/WarningsAsErrors.cmake and inspect how /W4 and /WX are added to ApprovalTests. Reproduce the Clang-on-Windows configuration with CMake and Ninja, then verify that Clang no longer receives these flags as file paths while the intended warning behavior remains for supported compilers.
Written by the indexing model from the issue text.
Description
Hi, thanks for this amazing library! I've used it a long throughout the years.
I am trying to build approval tests with Clang on Windows, and I got the following error:
clang++: error: no such file or directory: '/W4'
clang++: error: no such file or directory: '/WX'
It appears that those warning flags are being added by CMake/WarningsAsErrors.cmake.
My current escape hatch:
get_target_property(approval_tests_opts ApprovalTests COMPILE_OPTIONS)
if (approval_tests_opts)
string(REPLACE "/W4" "" approval_tests_opts "${approval_tests_opts}")
string(REPLACE "/WX" "" approval_tests_opts "${approval_tests_opts}")
set_target_properties(ApprovalTests PROPERTIES COMPILE_OPTIONS "${approval_tests_opts}")
endif ()
Extra information of my build
Project: Charlie3D
target to build: charlie3d_test
The Approval Test libary are pulled via CPM:
CPMAddPackage(
NAME approvaltests
GITHUB_REPOSITORY approvals/ApprovalTests.cpp
GIT_TAG v.10.13.0
SYSTEM TRUE
)
CMake generated command:
C:\Users\Lenovo\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/Users/Lenovo/AppData/Local/Programs/CLion/bin/ninja/win/x64/ninja.exe -DBEYOND_CORE_BUILD_TESTS=ON -DCMAKE_TOOLCHAIN_FILE=C:\Users\Lenovo\.clion-vcpkg\vcpkg\scripts\buildsystems\vcpkg.cmake -DCHARLIE3D_BUILD_TESTS=OFF -G Ninja -S E:\Dev\Charlie3D -B E:\Dev\Charlie3D\cmake-build-debug-clang
Other Information:
clang version 21.1.8
Target: x86_64-pc-windows-msvc
cmake version 3.31.6 (CMake; JetBrains IDE bundle; build 29)
OS: Windows 11
- Dominant language
- C++
- Stars
- 339
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from approvals/ApprovalTests.cpp
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
approvals/ApprovalTests.cpp#246 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
approvals/ApprovalTests.cpp#242 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
approvals/ApprovalTests.cpp#226 · 2 comments ·
-
bug namers
Difficulty 3/5 1-2 days Newbie friendliness 45/100
approvals/ApprovalTests.cpp#225 · 5 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
approvals/ApprovalTests.cpp#217 · 4 comments ·
All issues in approvals/ApprovalTests.cpp
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·