Disable std::filesystem on macOS when compiling C++17 but targetting <10.15 #335
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.
macOS flat out refuses to compile if you touch
std::filesystem::path
when targetting macOS < 10.15 (to be able to deploy a binary to older macOS versions) with the-mmacosx-version-min=10.14
(or earlier) compiler flags.If you try to compile code with
::path
(even if you don't actually call it) the Apple clang gods smite you with:This is reportedly caused by Apple's C++ team being somewhat incompetent at actually updating libc++ when they push out new releases, so libc++ stl features (in this case, to get at the std::filesystem exceptions from libc++) often lag behind the compiler by years, and Apple never releases libc++ updates for older mac versions because they don't care because C++ isn't Swift and only Swift is great and good.
</rant>
Anyway, this PR works around the issue by disabling the std::filesystem::path support when in C++17 mode when targetting macOS before 10.15.
I also broke up the hairy macro conditions because it was already hard to follow and would have gotten worse if kept in a single condition.