Browse Source

Get timespec working on mingw

See also: #34
tony 10 years ago
parent
commit
ca0e14f879
1 changed files with 9 additions and 11 deletions
  1. 9 11
      CMakeLists.txt

+ 9 - 11
CMakeLists.txt

@@ -242,12 +242,20 @@ if (NOT MSVC)
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
 endif(NOT MSVC)
 
+if (MINGW)
+    # workaround for pthread.h and time.h from mingw colliding
+    include(CheckStructHasMember)
+
+    CHECK_STRUCT_HAS_MEMBER ("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
+    if (HAVE_STRUCT_TIMESPEC)
+        set(OX_DEFINITIONS	${OX_DEFINITIONS} -D_TIMESPEC_DEFINED=1)
+    endif()
+endif()
 
 add_definitions(${OX_DEFINITIONS})
 include_directories(${OXYGINE_INCLUDE_DIRS})
 add_library(oxygine-framework STATIC ${SOURCES})
 
-
 set(OXYGINE_LIBRARY_DIRS
 	${OXYGINE_LIBRARY_DIRS}
 	PARENT_SCOPE)
@@ -268,16 +276,6 @@ set(OXYGINE_JS_LIBRARIES
 	${OXYGINE_JS_LIBRARIES}
 	PARENT_SCOPE)
 
-if (MINGW)
-    # workaround for with pthreads.h and time.h from mingw collide
-    include(CheckStructHasMember)
-
-    CHECK_STRUCT_HAS_MEMBER ("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC)
-    if (HAVE_STRUCT_TIMESPEC)
-        ADD_DEFINITIONS(-D_TIMESPEC_DEFINED=1)
-    endif()
-endif()
-
 message(STATUS "SDL includes: ${SDL2_INCLUDE_DIR}")
 message(STATUS "Libs:     ${CORE_LIBS}")
 message(STATUS "Platform: ${PLATFORM}")