CheckSTDC.cmake 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. message(STATUS "Checking whether system has ANSI C header files")
  2. include(CheckPrototypeExists)
  3. include(CheckIncludeFiles)
  4. check_include_files("dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;strings.h;string.h;float.h" StandardHeadersExist)
  5. if(StandardHeadersExist)
  6. check_prototype_exists(memchr string.h memchrExists)
  7. if(memchrExists)
  8. check_prototype_exists(free stdlib.h freeExists)
  9. if(freeExists)
  10. message(STATUS "ANSI C header files - found")
  11. set(STDC_HEADERS 1 CACHE INTERNAL "System has ANSI C header files")
  12. set(HAVE_STRINGS_H 1)
  13. set(HAVE_STRING_H 1)
  14. set(HAVE_FLOAT_H 1)
  15. set(HAVE_STDLIB_H 1)
  16. set(HAVE_STDDEF_H 1)
  17. set(HAVE_STDINT_H 1)
  18. set(HAVE_INTTYPES_H 1)
  19. set(HAVE_DLFCN_H 1)
  20. endif(freeExists)
  21. endif(memchrExists)
  22. endif(StandardHeadersExist)
  23. if(NOT STDC_HEADERS)
  24. message(STATUS "ANSI C header files - not found")
  25. set(STDC_HEADERS 0 CACHE INTERNAL "System has ANSI C header files")
  26. endif(NOT STDC_HEADERS)
  27. check_include_files(unistd.h HAVE_UNISTD_H)
  28. include(CheckDIRSymbolExists)
  29. check_dirsymbol_exists("sys/stat.h;sys/types.h;dirent.h" HAVE_DIRENT_H)
  30. if (HAVE_DIRENT_H)
  31. set(HAVE_SYS_STAT_H 1)
  32. set(HAVE_SYS_TYPES_H 1)
  33. endif (HAVE_DIRENT_H)