Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
pthread is not necessarily defined on windows
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 28 Jul 2015 22:23:38 +0000 (00:23 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 28 Jul 2015 22:33:05 +0000 (00:33 +0200)
buildtools/Cmake/MakeLib.cmake
buildtools/Cmake/MakeLibWin.cmake
include/xbt/xbt_os_thread.h

index 2f46f6d..153ca35 100644 (file)
@@ -58,7 +58,7 @@ else()
   set(SIMGRID_DEP "${SIMGRID_DEP} -lstdc++")
 endif()
 
-if(pthread AND ${CONTEXT_THREADS} AND NOT APPLE)
+if(HAVE_PTHREAD AND ${CONTEXT_THREADS} AND NOT APPLE)
   # Clang on recent Mac OS X is not happy about -pthread.
   SET(SIMGRID_DEP "${SIMGRID_DEP} -pthread")
 endif()
index b1a8a3a..c62d9bb 100644 (file)
@@ -9,7 +9,11 @@ add_library(simgrid SHARED ${simgrid_sources})
 
 set_target_properties(simgrid  PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" LINK_FLAGS "-shared" VERSION ${libsimgrid_version} PREFIX "lib" SUFFIX ".dll" IMPORT_PREFIX "lib" IMPORT_SUFFIX ".dll")
 
-set(SIMGRID_DEP "-lws2_32 -lpthread -lm")
+set(SIMGRID_DEP "-lws2_32 -lm")
+
+if (HAVE_PTHREAD)
+  set(SIMGRID_DEP "${SIMGRID_DEP} -lpthread")
+endif()
 
 if(ARCH_32_BITS)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i486 -D_I_X86_")
index 539d57b..727aa92 100644 (file)
@@ -25,12 +25,13 @@ SG_BEGIN_DECL()
   /** \brief Thread data type (opaque structure) */
 typedef struct xbt_os_thread_ *xbt_os_thread_t;
 
-#include <pthread.h>
 
 #ifdef _XBT_WIN32 /* defined if this is a windows system, 32bits or 64bits) */
 #include <windef.h>
 typedef DWORD xbt_os_thread_key_t;
 #else /* assume that every non-windows system is POSIX-compatible */
+
+#include <pthread.h>
 typedef pthread_key_t xbt_os_thread_key_t;
 #endif