CrucibleCheckRuntimeCapabilities.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
include_guard(GLOBAL) include(CheckCXXSourceCompiles) function(crucible_check_runtime_capabilities) cmake_parse_arguments(RUNTIME_CAPABILITY "" "PREFIX" "" ${ARGV}) crucible_check_dirent_d_namlen("${RUNTIME_CAPABILITY_PREFIX}") endfunction() # Linux has this, but macOS does not, in which case we need to fall back to std::strlen() function(crucible_check_dirent_d_namlen RUNTIME_CAPABILITY_PREFIX) check_cxx_source_compiles( " #include <dirent.h> int main() { struct ::dirent entry; entry.d_namlen = 0; return 0; } " "${RUNTIME_CAPABILITY_PREFIX}_DIRENT_D_NAMLEN") endfunction()