cmake: better check for CPP17 parallelism
[m6w6/libmemcached] / CMake / CheckCpp17Parallelism.cmake
1 configure_define(HAVE_CPP17_PARALLELISM)
2
3 #
4 # see CheckTbb.cmake on change
5 #
6
7 check_cxx_source_compiles("
8 #include <vector>
9 #include <algorithm>
10 #include <execution>
11 int main() {
12 std::vector<char> a = {1,2,3};
13 std::all_of(std::execution::par, a.begin(), a.end(), [](char i) {
14 return i>0;
15 });
16 }
17 "
18 HAVE_CPP17_PARALLELISM
19 )
20
21 if(HAVE_CPP17_PARALLELISM)
22 add_library(cpp17::paralleslism INTERFACE IMPORTED)
23 # noting to be done
24 else()
25 include(CheckTbb)
26 set(HAVE_CPP17_PARALLELISM "${HAVE_TBB}")
27 if(HAVE_TBB)
28 add_library(cpp17::parallelism ALIAS "${LIBTBB}")
29 endif()
30 endif()