VS 2019 16.3 deprecates <experimental/filesystem>. #6968
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
VS 2019 16.3 will contain a couple of source-breaking changes:
<experimental/filesystem>
will be deprecated via an impossible-to-miss preprocessor "#error
The<experimental/filesystem>
header providingstd::experimental::filesystem
is deprecated by Microsoft and will be REMOVED. It is superseded by the C++17<filesystem>
header providingstd::filesystem
. You can define_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
to acknowledge that you have received this warning."<filesystem>
will no longer include<experimental/filesystem>
.In the long term, I believe that vcpkg should detect when it's being built with VS 2017 15.7 or newer, compile in C++17 mode, include
<filesystem>
, and usestd::filesystem
. (Activating this for VS 2019 16.0 or newer would also be reasonable.) Similarly for other toolsets supportingstd::filesystem
.In the short term, this commit makes vcpkg compatible with the upcoming deprecation. First, we need to define the silencing macro before including the appropriate header. I've chosen to define it unconditionally (without checking for platform or version), since it has no effect for other platforms or versions. Second, we need to deal with
<filesystem>
no longer including<experimental/filesystem>
. I verified that VS 2015 Update 3 contained<experimental/filesystem>
(back then, it simply included the<filesystem>
header, where the experimental implementation was defined; this was later reorganized). Therefore, all of vcpkg's supported MSVC toolsets have<experimental/filesystem>
, so we can simply always include it.I've verified that this builds with both VS 2015 Update 3 and VS 2019 16.1.3 (the current production version).