Skip to content

Commit

Permalink
Merge pull request #1496 from willson556/master
Browse files Browse the repository at this point in the history
More reliable `gettimeofday` detection.
  • Loading branch information
basvodde committed Nov 24, 2021
2 parents 17f0037 + 4d75573 commit 970a097
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@ endif()

# Check for functions before setting a lot of stuff
include(CheckFunctionExists)
include(CheckSymbolExists)
set (CMAKE_REQUIRED_INCLUDES "unistd.h")
check_function_exists(fork HAVE_FORK)
check_symbol_exists(fork "unistd.h" HAVE_FORK)
if(HAVE_FORK)
add_definitions(-DCPPUTEST_HAVE_FORK)
endif(HAVE_FORK)

check_function_exists(waitpid HAVE_WAITPID)
check_symbol_exists(waitpid "sys/wait.h" HAVE_WAITPID)
if(HAVE_WAITPID)
add_definitions(-DCPPUTEST_HAVE_WAITPID)
endif(HAVE_WAITPID)

check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_symbol_exists(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY)
if(HAVE_GETTIMEOFDAY)
add_definitions(-DCPPUTEST_HAVE_GETTIMEOFDAY=1)
endif(HAVE_GETTIMEOFDAY)

check_function_exists(pthread_mutex_lock HAVE_PTHREAD_MUTEX_LOCK)
check_symbol_exists(pthread_mutex_lock "pthread.h" HAVE_PTHREAD_MUTEX_LOCK)
if(HAVE_PTHREAD_MUTEX_LOCK)
add_definitions(-DCPPUTEST_HAVE_PTHREAD_MUTEX_LOCK=1)
endif(HAVE_PTHREAD_MUTEX_LOCK)
Expand Down

0 comments on commit 970a097

Please sign in to comment.