Skip to content

Commit 61f5f9b

Browse files
committed
Merge pull request #972 from itavero/mingw-timespec
Workaround for timespec redefinition when using MinGW
2 parents f2cef55 + a61da03 commit 61f5f9b

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)