Skip to content

Commit

Permalink
fix: fmt workaround for pkg-config generation (#2293)
Browse files Browse the repository at this point in the history
Summary:
Workaround for #2250.

Ideally, the code should support the generator expression, but this workaround fixes the problem for fmt.

Also, see fmtlib/fmt#4159 and microsoft/vcpkg#40944

Pull Request resolved: #2293

Reviewed By: Gownta

Differential Revision: D62785183

Pulled By: Orvid

fbshipit-source-id: d45768f12d28f53122fdedfc396f1d27c7259d19
  • Loading branch information
aminya authored and facebook-github-bot committed Sep 30, 2024
1 parent 9cb183c commit 1cc9a3a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMake/GenPkgConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ function(gen_pkgconfig_vars)
"<COMPILE_LANG_AND_ID:CUDA,NVIDIA>" "<COMPILE_LANGUAGE:CUDA>"
cflags "${cflags}"
)

endif()
# patch for fmt's generator expression
if (MSVC)
# fmt 11.0.3 and above
string(REPLACE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>" "/utf-8" cflags "${cflags}")
# fmt 11.0.2 and below
string(REPLACE "$<$<COMPILE_LANGUAGE:CXX>:/utf-8>" "/utf-8" cflags "${cflags}")
endif()

set("${var_prefix}_CFLAGS" "${cflags}" PARENT_SCOPE)
Expand Down

0 comments on commit 1cc9a3a

Please sign in to comment.