summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindStdFilesystem_test.cc
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2018-07-28 04:36:20 +0200
committerKefu Chai <kchai@redhat.com>2018-07-29 14:25:32 +0200
commite6c7e0f521f38040c51b1115f5a9968a35fca87d (patch)
treef35830d62999cb1a01f240235b420366a358d72e /cmake/modules/FindStdFilesystem_test.cc
parentcmake: set HAVE_DPDK if it's available (diff)
downloadceph-e6c7e0f521f38040c51b1115f5a9968a35fca87d.tar.xz
ceph-e6c7e0f521f38040c51b1115f5a9968a35fca87d.zip
cmake: extract std::filesystem linkage checking into module
see https://libcxx.llvm.org/docs/UsingLibcxx.html#using-libc-experimental-and-experimental, > Note that as of libc++ 7.0 using the <experimental/filesystem> > requires linking libc++fs instead of libc++experimental. do not build ceph_test_admin_socket_output if we are not able to find the library for std::experimental::filesystem . it is a workaround of https://reviews.freebsd.org/D10840 where FreeBSD 11.2 does not ship libc++experimental.a . Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'cmake/modules/FindStdFilesystem_test.cc')
-rw-r--r--cmake/modules/FindStdFilesystem_test.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmake/modules/FindStdFilesystem_test.cc b/cmake/modules/FindStdFilesystem_test.cc
new file mode 100644
index 00000000000..82f2a8b576b
--- /dev/null
+++ b/cmake/modules/FindStdFilesystem_test.cc
@@ -0,0 +1,13 @@
+#if __has_include(<filesystem>)
+#include <filesystem>
+namespace fs = std::filesystem;
+#elif __has_include(<experimental/filesystem>)
+#include <experimental/filesystem>
+namespace fs = std::experimental::filesystem;
+#else
+#error std::filesystem not available!
+#endif
+
+int main() {
+ [[maybe_unused]] fs::path path("/");
+}