cmake HAVE_DIRFD examples

libarchive/libarchive CMakeLists.txt :1592

CHECK_C_SOURCE_COMPILES(
  "#include <dirent.h>\nint main() {DIR *d = opendir(\".\"); return dirfd(d);}"
  HAVE_DIRFD)

USNavalResearchLaboratory/norm CMakeLists.txt :16

check_cxx_symbol_exists(dirfd "dirent.h" HAVE_DIRFD)

USNavalResearchLaboratory/norm CMakeLists.txt :18

list(APPEND PLATFORM_DEFINITIONS HAVE_DIRFD)

USNavalResearchLaboratory/norm android/lib/CMakeLists.txt :6

add_definitions("-DANDROID=1" "-DANDROID_API_VERSION=24" "-DPUSH_NOTIFICATIONS=1" "-DANDROID" "-DLINUX" "-DUNIX" "-DHAVE_IPV6" "-DHAVE_DIRFD" "-DPROTO_DEBUG" "-DHAVE_ASSERT" "-DHAVE_GETLOGIN" "-DUSE_SELECT" "-D_FILE_OFFSET_BITS=64" "-DHAVE_OLD_SIGNALHANDLER" "-DHAVE_SCHED" "-DNO_SCM_RIGHTS" "-Wno-attributes" "-DAPP_VERSION=1.0.0" "-DAPP_VERSION_HEX=0x10000")

JulNadeauCA/libagar CMakeChecks.cmake :1016

check_c_source_compiles("
#include <dirent.h>

int
main(int argc, char *argv[])
{
	DIR *dirp = opendir(\"foo\");
	int fd = -1;
	if (dirp != NULL) {
		fd = dirfd(dirp);
		closedir(dirp);
	}
	return (fd == -1);
}
" HAVE_DIRFD)