Skip to content

Commit

Permalink
cmake: Include time.h on several checks to prevent false negatives
Browse files Browse the repository at this point in the history
The clock_t, clockid_t and timer_t types are deemed not found when they
are actually available if time.h is included. Include the header during
the checks.

Patch#53

git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1204 64e312b2-a51f-0410-8e61-82d0ca0eb02a
  • Loading branch information
brarcher committed Jun 14, 2015
1 parent d6c7064 commit 0d5e2cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Contributors:
Stewart Brodie (bug fix: no fork mode failure reporting with teardowns)
Michał Dębski (Use mkstemp() if available instead of tmpfile() or tempnam())
Sebastian Dröge (Kill running tests if SIGTERM or SIGINT are caught in test runner)
Matt Clarkson (Fix CMake checks using time.h for MinGW and MSVC)

Anybody who has contributed code to Check or Check's build system is
considered an author. Send patches to this file to
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,19 @@ check_type_size(uint64_t UINT64_T)
check_type_size(uintmax_t UINTMAX_T)

#
set(CMAKE_EXTRA_INCLUDE_FILES time.h)
check_type_size(clock_t CLOCK_T)
if(NOT HAVE_CLOCK_T)
set(clock_t int)
endif(NOT HAVE_CLOCK_T)
unset(CMAKE_EXTRA_INCLUDE_FILES)
#
set(CMAKE_EXTRA_INCLUDE_FILES time.h)
check_type_size(clockid_t CLOCKID_T)
if(NOT HAVE_CLOCKID_T)
set(clockid_t int)
endif(NOT HAVE_CLOCKID_T)
unset(CMAKE_EXTRA_INCLUDE_FILES)
#
check_type_size(size_t SIZE_T)
if(NOT HAVE_SIZE_T)
Expand Down Expand Up @@ -254,10 +258,12 @@ if(NOT HAVE_PID_T)
endif(WIN32)
endif(NOT HAVE_PID_T)
#
set(CMAKE_EXTRA_INCLUDE_FILES time.h)
check_type_size(timer_t TIMER_T)
if(NOT HAVE_TIMER_T)
set(timer_t int)
endif(NOT HAVE_TIMER_T)
unset(CMAKE_EXTRA_INCLUDE_FILES)

###############################################################################
# Check libraries
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
In Development:
# Mentioning Check 0.9.14 for now, to fix distcheck target until next release

* CMake on MinGW and MSVC was unable to find time related types because
time.h was not included. This header is now included for the checks.
Patch #53.

* If the test runner process catches a SIGTERM or SIGINT signal the running
tests are now also killed.
Patch #52.
Expand Down

0 comments on commit 0d5e2cc

Please sign in to comment.