Commit Graph

2 Commits

Author SHA1 Message Date
Kefu Chai
bbd95765cc cmake: fix StdFilesystem detection
before this change, we fails to detect std::filesystem with clang++,
because  the cmake project created by try_compile() only expands
following options passed from its caller:
- COMPILE_DEFINITIONS
- INCLUDE_DIRECTORIES
- LINK_DIRECTORIES
- LINK_LIBRARIES

which do not include CMAKE_CXX_FLAGS, so either we need to (ab)use
COMPILE_DEFINITIONS for passing -std=c++17, or we can change the
CMAKE_CXX_FLAGS in the parent env, as it turns out the created cmake
project does inherit this flag from current project. in this change,
we use the COMPILE_DEFINITIONS approach: simpler this way. and we
can drop it once cmake 3.8 is required.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2018-08-02 14:37:49 +08:00
Kefu Chai
e6c7e0f521 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>
2018-07-29 20:25:32 +08:00