Skip to content

Commit a61da03

Browse files
committed
Added workaround to prevent the redefinition of timespec when using MinGW (see #971 ).
1 parent 7ea6f14 commit a61da03

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ if(HAVE_FORK)
1414
add_definitions(-DCPPUTEST_HAVE_FORK)
1515
endif(HAVE_FORK)
1616

17+
# Apply workaround for MinGW timespec redefinition (pthread.h / time.h)
18+
if (MINGW)
19+
include(CheckStructHasMember)
20+
check_struct_has_member("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
21+
if (HAVE_STRUCT_TIMESPEC)
22+
add_definitions(-D_TIMESPEC_DEFINED=1)
23+
endif()
24+
endif()
25+
1726
option(STD_C "Use the standard C library" ON)
1827
option(STD_CPP "Use the standard C++ library" ON)
1928
option(CPPUTEST_FLAGS "Use the CFLAGS/CXXFLAGS/LDFLAGS set by CppUTest" ON)

0 commit comments

Comments
 (0)