Q:

Check for time.h / sys/time.h compatibilty

I am currently porting an autotools project to CMake that uses the AC_HEADER_TIME autotools macro to check if I can include both time.h and sys/time.h. 
How can this be done with CMake? 

A:

It isn't the time test specifically, but for an example of how to do that sort of thing you might check out this example from BRL-CAD:
http://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/misc/CMake/test_srcs/sys_wait_test.c
The code is then used to do a test in CMake with:
CHECK_C_SOURCE_RUNS(${CMAKE_SOURCE_DIR}/misc/CMake/test_srcs/sys_wait_test.c SYS_WAIT_TEST_RUNS)

You can also use CHECK_C_SOURCE_COMPILES if you don't want to try to run the code (we usually do, but that sort of thing is situation dependent.)  See http://www.cmake.org/cmake/help/v3.0/module/CheckCSourceRuns.html
and 
http://www.cmake.org/cmake/help/v3.0/module/CheckCSourceCompiles.html for more information about using variables to control how the compilation is done.   Generally speaking if you need to set those variables, you'll want to cache their current values before specifying the test values and then restore the original values after the test, i.e.
set(CMAKE_REQUIRED_FLAGS_CACHE ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "-foo_flag")
CHECK_C_SOURCE_RUNS(${CMAKE_SOURCE_DIR}/CMake/time_test.c TIME_TEST_RUNS)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_CACHE})

I've had a few puzzling behaviors in tests over the years that resulted from leftovers from one test interfering with another.