Skip to content

Commit f34dbbf

Browse files
authored
vcpkg: add an overlay port for fmt 11.1.4; enable /W3 (#18729)
This pull request brings us up to fmt 11.1.4 and enables `FMT_PEDANTIC`. `FMT_PEDANTIC` turns on `/W3`, which is required by our local feudal lords who will automatically file bugs on us if we don't build with enough warnings enabled.
1 parent 6eb6512 commit f34dbbf

File tree

5 files changed

+81
-2
lines changed

5 files changed

+81
-2
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 88c12148..967b53dd 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -260,7 +260,7 @@ if (FMT_MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio")
6+
join(netfxpath
7+
"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\"
8+
".NETFramework\\v4.0")
9+
- file(WRITE run-msbuild.bat "
10+
+ file(WRITE "${CMAKE_BINARY_DIR}/run-msbuild.bat" "
11+
${MSBUILD_SETUP}
12+
${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*")
13+
endif ()
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO fmtlib/fmt
4+
REF "${VERSION}"
5+
SHA512 573b7de1bd224b7b1b60d44808a843db35d4bc4634f72a9edcb52cf68e99ca66c744fd5d5c97b4336ba70b94abdabac5fc253b245d0d5cd8bbe2a096bf941e39
6+
HEAD_REF master
7+
PATCHES
8+
fix-write-batch.patch
9+
)
10+
11+
vcpkg_cmake_configure(
12+
SOURCE_PATH "${SOURCE_PATH}"
13+
OPTIONS
14+
-DFMT_CMAKE_DIR=share/fmt
15+
-DFMT_TEST=OFF
16+
-DFMT_DOC=OFF
17+
-DFMT_PEDANTIC=ON
18+
)
19+
20+
vcpkg_cmake_install()
21+
vcpkg_cmake_config_fixup()
22+
vcpkg_fixup_pkgconfig()
23+
vcpkg_copy_pdbs()
24+
25+
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
26+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fmt/base.h"
27+
"defined(FMT_SHARED)"
28+
"1"
29+
)
30+
endif()
31+
32+
file(REMOVE_RECURSE
33+
"${CURRENT_PACKAGES_DIR}/debug/include"
34+
"${CURRENT_PACKAGES_DIR}/debug/share"
35+
)
36+
37+
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
38+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

dep/vcpkg-overlay-ports/fmt/usage

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The package fmt provides CMake targets:
2+
3+
find_package(fmt CONFIG REQUIRED)
4+
target_link_libraries(main PRIVATE fmt::fmt)
5+
6+
# Or use the header-only version
7+
find_package(fmt CONFIG REQUIRED)
8+
target_link_libraries(main PRIVATE fmt::fmt-header-only)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "fmt",
3+
"version": "11.1.4",
4+
"description": "{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.",
5+
"homepage": "https://github.com/fmtlib/fmt",
6+
"license": "MIT",
7+
"dependencies": [
8+
{
9+
"name": "vcpkg-cmake",
10+
"host": true
11+
},
12+
{
13+
"name": "vcpkg-cmake-config",
14+
"host": true
15+
}
16+
]
17+
}

vcpkg.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"overrides": [
1818
{
1919
"name": "fmt",
20-
"version": "11.0.2"
20+
"version": "11.1.4"
2121
},
2222
{
2323
"name": "ms-gsl",
@@ -36,5 +36,8 @@
3636
"version": "0.30.3"
3737
}
3838
],
39-
"builtin-baseline": "fe1cde61e971d53c9687cf9a46308f8f55da19fa"
39+
"builtin-baseline": "fe1cde61e971d53c9687cf9a46308f8f55da19fa",
40+
"vcpkg-configuration": {
41+
"overlay-ports": [ "./dep/vcpkg-overlay-ports" ]
42+
}
4043
}

0 commit comments

Comments
 (0)