-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds checks for whether the toolchain in use is using libc++ and if it only has an experimental version of memory_resource Essentially this is necessary to support building c++17/20 with older clangs using libc++.
- Loading branch information
1 parent
436d339
commit 117b3f7
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include(CheckCXXSourceCompiles) | ||
|
||
# The libc++ implementation that ships with clang < v16 still | ||
# has the memory_resource header under experimental. | ||
# | ||
# This functions checks if we are using such a standard library | ||
# implementation. | ||
# | ||
function(check_experimental_memory_resource success) | ||
check_cxx_source_compiles(" | ||
#include <experimental/memory_resource> | ||
int main() { | ||
return 0; | ||
} | ||
" ${success}) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
include(CheckCXXSourceCompiles) | ||
|
||
# Checks if libc++ is being used | ||
# | ||
function(check_libcpp success) | ||
check_cxx_source_compiles(" | ||
#include <iostream> | ||
int a = | ||
#ifdef _LIBCPP_VERSION | ||
1; | ||
#else | ||
kdfasfdl | ||
#endif | ||
int main() { | ||
return 0; | ||
} | ||
" ${success}) | ||
endfunction() |