I'm currently converting a small C project from autotools to CMake.
In the old configure.in
I checked every header and library function for existence using the following lines:
# Checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h time.h math.h sys/stat.h errno.h unistd.h fcntl.h signal.h])
# Checks for library functions
AC_FUNC_FORK
AC_CHECK_FUNCS([time localtime mktime gmtime exit fork chdir atol signal])
AC_FUNC_STRFTIME
It's what many autotools projects do AFAIK.
Despite the fact that the compiler already checks for necessary header files and the linker checks for library functions, my code still needs these checks done at configure stage to properly setup it's compile flags for #ifdef HAVE_FOOBAR
and alike.
In this case, what is the best practice to check for headers/functions with CMake?