Skip to content

Commit

Permalink
[fmt] pass /utf-8 only if the compiler is MSVC at build time
Browse files Browse the repository at this point in the history
Backporting fmtlib/fmt#4159
  • Loading branch information
aminya committed Sep 12, 2024
1 parent 2824aef commit 7fc10dd
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ca64fff..1606e886 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -365,8 +365,8 @@ if (NOT MSVC)
# Unicode is always supported on compilers other than MSVC.
elseif (FMT_UNICODE)
# Unicode support requires compiling with /utf-8.
- target_compile_options(fmt PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/utf-8>)
- target_compile_options(fmt-header-only INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/utf-8>)
+ target_compile_options(fmt PUBLIC $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>)
+ target_compile_options(fmt-header-only INTERFACE $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>)
else ()
target_compile_definitions(fmt PUBLIC FMT_UNICODE=0)
endif ()
--
2.34.1
3 changes: 2 additions & 1 deletion ports/fmt/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fix-write-batch.patch
fix-pass-utf-8-only-if-the-compiler-is-MSVC-at-build # remove in next release
)

vcpkg_cmake_configure(
Expand All @@ -28,7 +29,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
)
endif()

file(REMOVE_RECURSE
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
Expand Down
1 change: 1 addition & 0 deletions ports/fmt/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "fmt",
"version": "11.0.2",
"port-version": 1,
"description": "{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.",
"homepage": "https://github.com/fmtlib/fmt",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,7 @@
},
"fmt": {
"baseline": "11.0.2",
"port-version": 0
"port-version": 1
},
"folly": {
"baseline": "2024.09.09.00",
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/fmt.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bd3e352daebd521502873d43ee2c4bb3c0743c07",
"version": "11.0.2",
"port-version": 1
},
{
"git-tree": "65fe4dea09fc09a30e6ece9ac19edb7ad6a49601",
"version": "11.0.2",
Expand Down

0 comments on commit 7fc10dd

Please sign in to comment.