You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindThirdPartyPThread.cmake 2.0KB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # ---------------------------------
  2. # Finds third party pthread lib
  3. # Adds library to target
  4. # Adds include path
  5. # ---------------------------------
  6. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyPThread)
  7. IF(WIN32)
  8. FIND_PATH(PTHREAD_DIR lib PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES pthread NO_DEFAULT_PATH)
  9. FIND_PATH(PTHREAD_DIR lib PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES pthreads NO_DEFAULT_PATH)
  10. FIND_LIBRARY(PTHREAD_LIB pthreadVC2 PATHS ${PTHREAD_DIR} PATH_SUFFIXES lib NO_DEFAULT_PATH)
  11. FIND_PROGRAM(PTHREAD_DLL pthread.dll PATHS ${PTHREAD_DIR} PATH_SUFFIXES bin NO_DEFAULT_PATH)
  12. INCLUDE("OvSetWindowsSDKPath")
  13. SET(WS232_LIB "WS232_LIB-NOTFOUND")
  14. FIND_LIBRARY(WS232_LIB ws2_32 ${OV_MS_SDK_PATH}/lib NO_DEFAULT_PATH)
  15. FIND_LIBRARY(WS232_LIB ws2_32 ${OV_MS_SDK_PATH}/lib)
  16. IF(PTHREAD_LIB AND WS232_LIB AND PTHREAD_DLL)
  17. OV_PRINT(OV_PRINTED " Found PThreads")
  18. INCLUDE_DIRECTORIES(${PTHREAD_DIR}/include)
  19. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${WS232_LIB})
  20. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PTHREAD_LIB})
  21. INSTALL(PROGRAMS "${PTHREAD_DLL}" DESTINATION ${DIST_BINDIR})
  22. ADD_DEFINITIONS(-DTARGET_HAS_PThread)
  23. ELSE()
  24. OV_PRINT(OV_PRINTED " FAILED to find PThreads")
  25. ENDIF()
  26. IF(PTHREAD_LIB)
  27. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${PTHREAD_LIB}")
  28. ELSE()
  29. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${PTHREAD_LIB}")
  30. ENDIF()
  31. IF(WS232_LIB)
  32. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${WS232_LIB}")
  33. ELSE()
  34. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${WS232_LIB}")
  35. ENDIF()
  36. ENDIF(WIN32)
  37. IF(UNIX)
  38. FIND_LIBRARY(LIB_STANDARD_MODULE_PTHREAD pthread)
  39. IF(LIB_STANDARD_MODULE_PTHREAD)
  40. OV_PRINT(OV_PRINTED " Found pthread...")
  41. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_STANDARD_MODULE_PTHREAD})
  42. ADD_DEFINITIONS(-DTARGET_HAS_PThread)
  43. ELSE(LIB_STANDARD_MODULE_PTHREAD)
  44. OV_PRINT(OV_PRINTED " FAILED to find pthread...")
  45. ENDIF(LIB_STANDARD_MODULE_PTHREAD)
  46. ENDIF(UNIX)
  47. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyPThread "Yes")