Skip to content

Fix MSVC compile option propagation for CUDA - #3694

Merged
gabime merged 2 commits into
gabime:v1.xfrom
Martell0x1:fix/msvc-cuda-header-only
Oct 24, 2026
Merged

gabime merged 2 commits into
gabime:v1.xfrom
Martell0x1:fix/msvc-cuda-header-only

Conversation

@Martell0x1

@Martell0x1 Martell0x1 commented Oct 24, 2026 •

Copy link
Copy Markdown

Summary

Fix propagation of /Zc:__cplusplus from spdlog::spdlog_header_only to CUDA compilation when using MSVC as the host compiler.

Problem

The header-only target currently propagates /Zc:__cplusplus unconditionally within the MSVC configuration. When a consumer target includes CUDA source files, this option can reach nvcc without being forwarded to the host compiler, resulting in a malformed compilation command.

Changes

  • Restrict /Zc:__cplusplus to C++ compilation.
  • Forward the option to the MSVC host compiler for CUDA compilation using -Xcompiler.

Validation

  • Linux build succeeds.
  • Existing tests pass.
  • Windows/MSVC + CUDA compilation is verified, or the lack of access to this environment is documented.

Fixes #3425.

@gabime
gabime merged commit 6d9805d into gabime:v1.x Oct 24, 2026
13 of 14 checks passed
@gabime

gabime commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Thanks @Martell0x1

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.

Issues with linking spdlog header only against a cuda project built with MSVC

2 participants