Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aminya opened this issue Sep 11, 2024 · 0 comments · Fixed by #4159
Closed

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

aminya opened this issue Sep 11, 2024 · 0 comments · Fixed by #4159

Comments

@aminya
Copy link
Contributor

aminya commented Sep 11, 2024

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

# 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).

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 a pull request may close this issue.

1 participant