← All tasks
cppfmtlib/fmt #4158Not a task: already works

Cannot compile with LLVM/Ninja on Windows due to `/utf-8`

envgap__fmtlib__fmt-4158

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
a5deb96bf51ec41f456e84a6f1083520b08d7275
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

fmtlib/fmt #4158 · read the original issue
<!--

Please make sure that the problem reproduces on the current master before

submitting an issue.

If possible please provide a repro on Compiler Explorer:

https://godbolt.org/z/fxccbh53W.

-->



Fmt has started adding `/utf-8` flags when installed through vcpkg on Windows even though it's not supported by Clang.

https://github.com/aminya/cpp_vcpkg_project/actions/runs/10810623863/job/29988266523?pr=55#step:6:213



Here's a full reproduction:

https://github.com/aminya/cpp_vcpkg_project/tree/a53c2ce04dd16a26a60a3c1d85d2df212977319a



Here are some generated code in `build/vcpkg_installed/x64-windows/share/fmt/fmt-targets.cmake`

```cmake

# Create imported target fmt::fmt

add_library(fmt::fmt SHARED IMPORTED)



set_target_properties(fmt::fmt PROPERTIES

  INTERFACE_COMPILE_DEFINITIONS "FMT_SHARED"

  INTERFACE_COMPILE_FEATURES "cxx_std_11"

  INTERFACE_COMPILE_OPTIONS "\$<\$<COMPILE_LANGUAGE:CXX>:/utf-8>"

  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"

)



# Create imported target fmt::fmt-header-only

add_library(fmt::fmt-header-only INTERFACE IMPORTED)



set_target_properties(fmt::fmt-header-only PROPERTIES

  INTERFACE_COMPILE_DEFINITIONS "FMT_HEADER_ONLY=1"

  INTERFACE_COMPILE_FEATURES "cxx_std_11"

  INTERFACE_COMPILE_OPTIONS "\$<\$<COMPILE_LANGUAGE:CXX>:/utf-8>"

  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"

)

```



This should be conditional. Although vcpkg might use its own toolchain, it doesn't mean the cmake file is going to be used with MSVC. This includes clang-tidy usage (different at build time than configuration time).
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]