Update fmt and fix no-PCH builds. (#1965)

Resolves https://github.com/microsoft/vcpkg-tool/issues/1902

The fmt folks did a lot of work to make their compilation time go down quite a bit so we shouldn't need the forward declaration any longer. Build time goes up a small amount but not enough to justify keeping the forward declarations and inline namespace hoops present.

On my 9970X test machine, a clean rebuild:
  Before: [driver] Build completed: 00:00:21.350
  After: [driver] Build completed: 00:00:21.562

GPT 5.4-Medium did much of the work here.
This commit is contained in:
Billy O'Neal authored and GitHub committed 2026-03-30 16:31:50 -07:00
1 parent 3dff4f66f6
commit 6a33bc9f5f
39 files changed
+116 -74

No files matched your search

+7
View File
@@ -79,6 +79,13 @@
"debug"
]
},
{
"name": "Win-x64-Debug-NoPch",
"inherits": "Win-x64-Debug",
"cacheVariables": {
"CMAKE_DISABLE_PRECOMPILE_HEADERS": true
}
},
{
"name": "Win-x64-Debug-WithArtifacts",
"inherits": [
+3 -3
View File
@@ -17,9 +17,9 @@
"Type": "other",
"other": {
"name": "fmt",
"version": "11.2.0",
"downloadUrl": "https://github.com/fmtlib/fmt/archive/refs/tags/11.2.0.tar.gz",
"hash": "sha1:bfa4fa35bb24f4ef239067173c373b211f2d8e84"
"version": "12.1.0",
"downloadUrl": "https://github.com/fmtlib/fmt/archive/refs/tags/12.1.0.tar.gz",
"hash": "sha1:dc7bc689e13d17dcae2dcb30ae6a47a7aeb1d3dd"
}
},
"DevelopmentDependency": false,
+6 -6
View File
@@ -9,7 +9,7 @@ if("$CACHE{VCPKG_FMT_URL}" MATCHES "^https://github.com/fmtlib/fmt/archive/refs/
unset(VCPKG_FMT_URL CACHE) # Fix upgrade
endif()
if(NOT VCPKG_FMT_URL)
set(VCPKG_FMT_URL "https://github.com/fmtlib/fmt/archive/refs/tags/11.2.0.tar.gz")
set(VCPKG_FMT_URL "https://github.com/fmtlib/fmt/archive/refs/tags/12.1.0.tar.gz")
endif()
if(POLICY CMP0135)
@@ -20,24 +20,24 @@ set(OLD_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(SKIP_WARNINGS OFF)
if(MSVC AND VCPKG_DEVELOPMENT_WARNINGS AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang"))
set(SKIP_WARNINGS ON)
# fmt\base.h(930): warning C4834: discarding return value of function with [[nodiscard]] attribute
string(APPEND CMAKE_CXX_FLAGS " /wd4834")
# fmt\base.h(930): warning C6031: Return value ignored: 'std::isalpha'.
string(APPEND CMAKE_CXX_FLAGS " /wd6031")
# base.h(1711) : warning C6294: Ill-defined for-loop. Loop body not executed.
string(APPEND CMAKE_CXX_FLAGS " /wd6294")
# fmt\base.h(451): warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>: Did you intend to use the bitwise-and (`&`) operator? If not, consider removing the redundant '<non-zero constant>' and the `&&` operator.
string(APPEND CMAKE_CXX_FLAGS " /wd6239")
# fmt\format.h(1058) : warning C6240: (<expression> && <non-zero constant>) always evaluates to the result of <expression>: Did you intend to use the bitwise-and (`&`)
string(APPEND CMAKE_CXX_FLAGS " /wd6240")
# This one is guarded by an assert
# fmt\os.h(377): warning C6326: Potential comparison of a constant with another constant.
string(APPEND CMAKE_CXX_FLAGS " /wd6326")
# fmt\format-inl.h(294): warning C6385: Reading invalid data from 'pow10_significands'.: Lines: 265, 267, 294
string(APPEND CMAKE_CXX_FLAGS " /wd6385")
endif()
include(FetchContent)
FetchContent_Declare(
fmt
URL "${VCPKG_FMT_URL}"
URL_HASH "SHA512=46974efd36e613477351aa357c451cee434da797c2a505f9f86d73e394dcb35dc2dc0cda66abb98c023e8f24deac9d8e3ee6f9f6c0971cc4c00e37c34aa7f15f"
URL_HASH "SHA512=f0da82c545b01692e9fd30fdfb613dbb8dd9716983dcd0ff19ac2a8d36f74beb5540ef38072fdecc1e34191b3682a8542ecbf3a61ef287dbba0a2679d4e023f2"
)
if(NOT fmt_FIND_REQUIRED)
+1 -2
View File
@@ -1,7 +1,6 @@
#pragma once
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fmt.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/stringview.h>
+3
View File
@@ -6,6 +6,9 @@
#include <vcpkg/commands.version.h>
#include <string>
#include <vector>
VCPKG_MSVC_WARNING(push)
// note: disable warning triggered by curl headers
// ws2tcpip.h(968): warning C6101: Returning uninitialized memory '*Mtu': A successful path through the function does
+1 -1
View File
@@ -2,7 +2,6 @@
#include <vcpkg/base/fwd/diagnostics.h>
#include <vcpkg/base/fwd/files.h>
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fwd/message_sinks.h>
#include <vcpkg/base/fwd/optional.h>
#include <vcpkg/base/fwd/span.h>
@@ -10,6 +9,7 @@
#include <vcpkg/base/checks.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/file-contents.h>
#include <vcpkg/base/fmt.h>
#include <vcpkg/base/lineinfo.h>
#include <vcpkg/base/messages.h>
#include <vcpkg/base/path.h>
+36 -3
View File
@@ -1,11 +1,11 @@
#pragma once
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/pragmas.h>
VCPKG_MSVC_WARNING(push)
// note:
// base.h(1737): warning C6294: Ill-defined for-loop. Loop body not executed.
// Arises in fmt/base.h template code only when supplied a nontype template parameter 0.
// base.h(1711): warning C6294: Ill-defined for-loop. Loop body not executed.
// Arises in template code only when supplied a nontype template parameter 0 which makes the loop body empty.
// format.h(1058): warning C6240: (<expression> && <non-zero constant>) always evaluates to the result of <expression>
@@ -13,11 +13,44 @@ VCPKG_MSVC_WARNING(push)
// format.h(1686): warning C6326: Potential comparison of a constant with another constant.
// Also arises from a macro
VCPKG_MSVC_WARNING(disable : 6240 6294 6326)
#include <fmt/base.h>
#include <fmt/compile.h>
#include <fmt/format.h>
#include <fmt/ranges.h>
VCPKG_MSVC_WARNING(pop)
#define VCPKG_FORMAT_AS(Type, Base) \
template<typename Char> \
struct fmt::formatter<Type, Char, void> : fmt::formatter<Base, Char, void> \
{ \
template<typename FormatContext> \
auto format(Type const& val, FormatContext& ctx) const -> decltype(ctx.out()) \
{ \
return fmt::formatter<Base, Char, void>::format(static_cast<Base>(val), ctx); \
} \
}
#define VCPKG_FORMAT_WITH_TO_STRING(Type) \
template<typename Char> \
struct fmt::formatter<Type, Char, void> : fmt::formatter<std::string, Char, void> \
{ \
template<typename FormatContext> \
auto format(Type const& val, FormatContext& ctx) const -> decltype(ctx.out()) \
{ \
return fmt::formatter<std::string, Char, void>::format(val.to_string(), ctx); \
} \
}
#define VCPKG_FORMAT_WITH_TO_STRING_LITERAL_NONMEMBER(Type) \
template<typename Char> \
struct fmt::formatter<Type, Char, void> : fmt::formatter<vcpkg::StringLiteral, Char, void> \
{ \
template<typename FormatContext> \
auto format(Type const& val, FormatContext& ctx) const -> decltype(ctx.out()) \
{ \
return fmt::formatter<vcpkg::StringLiteral, Char, void>::format(to_string_literal(val), ctx); \
} \
}
template<class T>
std::string adapt_to_string(const T& val)
{
-46
View File
@@ -1,46 +0,0 @@
#pragma once
namespace fmt
{
inline namespace v11
{
template<typename T, typename Char, typename Enable>
struct formatter;
template<typename Char>
class basic_string_view;
}
}
#define VCPKG_FORMAT_AS(Type, Base) \
template<typename Char> \
struct fmt::formatter<Type, Char, void> : fmt::formatter<Base, Char, void> \
{ \
template<typename FormatContext> \
auto format(Type const& val, FormatContext& ctx) const -> decltype(ctx.out()) \
{ \
return fmt::formatter<Base, Char, void>::format(static_cast<Base>(val), ctx); \
} \
}
#define VCPKG_FORMAT_WITH_TO_STRING(Type) \
template<typename Char> \
struct fmt::formatter<Type, Char, void> : fmt::formatter<std::string, Char, void> \
{ \
template<typename FormatContext> \
auto format(Type const& val, FormatContext& ctx) const -> decltype(ctx.out()) \
{ \
return fmt::formatter<std::string, Char, void>::format(val.to_string(), ctx); \
} \
}
#define VCPKG_FORMAT_WITH_TO_STRING_LITERAL_NONMEMBER(Type) \
template<typename Char> \
struct fmt::formatter<Type, Char, void> : fmt::formatter<vcpkg::StringLiteral, Char, void> \
{ \
template<typename FormatContext> \
auto format(Type const& val, FormatContext& ctx) const -> decltype(ctx.out()) \
{ \
return fmt::formatter<vcpkg::StringLiteral, Char, void>::format(to_string_literal(val), ctx); \
} \
}
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fmt.h>
#include <string>
+1
View File
@@ -12,6 +12,7 @@
#include <limits.h>
#include <algorithm>
#include <functional>
#include <vector>
namespace vcpkg::Strings::details
+2 -1
View File
@@ -1,8 +1,9 @@
#pragma once
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fwd/stringview.h>
#include <vcpkg/base/fmt.h>
#include <stddef.h>
#include <string.h>
+1
View File
@@ -11,6 +11,7 @@
#endif
#include <Shlobj.h>
#include <shellapi.h>
#include <windows.h>
#else // ^^^^ Windows / Unix vvvv
+2 -1
View File
@@ -3,11 +3,12 @@
#include <vcpkg/base/fwd/diagnostics.h>
#include <vcpkg/base/fwd/expected.h>
#include <vcpkg/base/fwd/files.h>
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fwd/optional.h>
#include <vcpkg/base/fwd/stringview.h>
#include <vcpkg/base/fwd/system.h>
#include <vcpkg/base/fmt.h>
#include <string>
#include <vector>
+2 -1
View File
@@ -2,12 +2,13 @@
#include <vcpkg/base/fwd/expected.h>
#include <vcpkg/base/fwd/file-contents.h>
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fwd/optional.h>
#include <vcpkg/base/fwd/stringview.h>
#include <vcpkg/fwd/bundlesettings.h>
#include <vcpkg/base/fmt.h>
#include <string>
namespace vcpkg
+2 -2
View File
@@ -1,9 +1,9 @@
#pragma once
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/fwd/cmakevars.h>
#include <vcpkg/fwd/triplet.h>
#include <vcpkg/base/fmt.h>
#include <vcpkg/packagespec.h>
#include <set>
+2
View File
@@ -9,6 +9,8 @@
#include <stddef.h>
#include <map>
#include <string>
#include <utility>
#include <vector>
+1 -1
View File
@@ -1,6 +1,5 @@
#pragma once
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fwd/parse.h>
#include <vcpkg/base/fwd/span.h>
@@ -8,6 +7,7 @@
#include <vcpkg/fwd/versions.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/fmt.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/unicode.h>
+1 -1
View File
@@ -1,11 +1,11 @@
#pragma once
#include <vcpkg/base/fwd/expected.h>
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fwd/optional.h>
#include <vcpkg/base/fwd/stringview.h>
#include <vcpkg/base/fwd/system.h>
#include <vcpkg/base/fmt.h>
#include <vcpkg/base/jsonreader.h>
#include <vcpkg/base/path.h>
+1 -1
View File
@@ -1,12 +1,12 @@
#pragma once
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fwd/optional.h>
#include <vcpkg/base/fwd/system.h>
#include <vcpkg/fwd/triplet.h>
#include <vcpkg/fwd/vcpkgcmdarguments.h>
#include <vcpkg/base/fmt.h>
#include <vcpkg/base/path.h>
#include <vcpkg/base/stringview.h>
+1 -1
View File
@@ -1,12 +1,12 @@
#pragma once
#include <vcpkg/base/fwd/fmt.h>
#include <vcpkg/base/fwd/optional.h>
#include <vcpkg/base/fwd/stringview.h>
#include <vcpkg/fwd/versions.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/fmt.h>
#include <vcpkg/base/optional.h>
namespace vcpkg
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/contractual-constants.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/parse.h>
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/checks.h>
#include <vcpkg/base/hash.h>
#include <vcpkg/base/messages.h>
-2
View File
@@ -5,8 +5,6 @@
#include <system_error>
#include <fmt/compile.h>
using namespace vcpkg;
namespace
+3
View File
@@ -16,7 +16,10 @@
#include <vcpkg/base/system.proxy.h>
#include <vcpkg/base/util.h>
#include <array>
#include <chrono>
#include <set>
#include <thread>
using namespace vcpkg;
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/checks.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/files.h>
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/json.h>
#include <vcpkg/base/messages.h>
#include <vcpkg/base/setup-messages.h>
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/api-stable-format.h>
#include <vcpkg/base/checks.h>
#include <vcpkg/base/expected.h>
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/checks.h>
#include <vcpkg/base/contractual-constants.h>
#include <vcpkg/base/diagnostics.h>
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/parse.h>
+1
View File
@@ -13,6 +13,7 @@
#include <map>
#include <set>
#include <unordered_set>
#if defined(__APPLE__)
extern char** environ;
+6
View File
@@ -1,6 +1,12 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/system.proxy.h>
#if defined(_WIN32)
#include <winhttp.h>
#endif
vcpkg::Optional<vcpkg::IEProxySetting> vcpkg::get_windows_ie_proxy_server()
{
#if defined(_WIN32)
+2
View File
@@ -25,7 +25,9 @@
#include <vcpkg/vcpkgpaths.h>
#include <vcpkg/xunitwriter.h>
#include <map>
#include <random>
#include <unordered_set>
using namespace vcpkg;
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/contractual-constants.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/strings.h>
@@ -4,6 +4,8 @@
#include <vcpkg/commands.format-feature-baselinet.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <algorithm>
using namespace vcpkg;
namespace
+2
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/fwd/message_sinks.h>
#include <vcpkg/base/checks.h>
+2
View File
@@ -30,6 +30,8 @@
#include <vcpkg/vcpkgcmdarguments.h>
#include <vcpkg/vcpkgpaths.h>
#include <unordered_set>
using namespace vcpkg;
namespace
+3
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/fwd/diagnostics.h>
#include <vcpkg/base/cofffilereader.h>
@@ -15,6 +17,7 @@
#include <set>
#include <string>
#include <system_error>
#include <unordered_set>
using namespace vcpkg;
+3 -1
View File
@@ -1,3 +1,5 @@
#include <vcpkg/base/system-headers.h>
#include <vcpkg/base/chrono.h>
#include <vcpkg/base/contractual-constants.h>
#include <vcpkg/base/curl.h>
@@ -582,7 +584,7 @@ namespace vcpkg
bool curl_upload_metrics(const std::string& payload)
{
if (payload.length() > static_cast<size_t>(std::numeric_limits<long>::max()))
if (payload.length() > static_cast<size_t>((std::numeric_limits<long>::max)()))
{
Debug::println("Metrics payload too large to upload");
return false;
+2
View File
@@ -6,6 +6,8 @@
#include <vcpkg/triplet.h>
#include <vcpkg/vcpkgcmdarguments.h>
#include <unordered_set>
namespace vcpkg
{
struct TripletInstance