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.

FindOpenViBEModuleSocket.cmake 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # ---------------------------------
  2. # Finds module Socket
  3. # Adds library to target
  4. # Adds include path
  5. # ---------------------------------
  6. OPTION(DYNAMIC_LINK_OPENVIBE_MODULE_SOCKET "Dynamically link OpenViBE module Socket" ON)
  7. IF(DYNAMIC_LINK_OPENVIBE_MODULE_SOCKET)
  8. SET(OPENVIBE_MODULE_SOCKET_LINKING "")
  9. ADD_DEFINITIONS(-DSocket_Shared)
  10. ELSE()
  11. SET(OPENVIBE_MODULE_SOCKET_LINKING "-static")
  12. ADD_DEFINITIONS(-DSocket_Static)
  13. ENDIF()
  14. set(PATH_OPENVIBE_MODULES_SOCKET "PATH_OPENVIBE_MODULES_SOCKET-NOTFOUND")
  15. set(SRC_DIR ${OV_BASE_DIR}/modules/socket/include)
  16. FIND_PATH(PATH_OPENVIBE_MODULES_SOCKET socket/defines.h PATHS ${SRC_DIR} NO_DEFAULT_PATH)
  17. IF(PATH_OPENVIBE_MODULES_SOCKET)
  18. debug_message( " Found OpenViBE module Socket... ${PATH_OPENVIBE_MODULE_SOCKET}/openvibe-module-socket${OPENVIBE_MODULE_SOCKET_LINKING}")
  19. INCLUDE_DIRECTORIES(${PATH_OPENVIBE_MODULES_SOCKET}/)
  20. TARGET_LINK_LIBRARIES(${PROJECT_NAME} openvibe-module-socket${OPENVIBE_MODULE_SOCKET_LINKING})
  21. ADD_DEFINITIONS(-DTARGET_HAS_Socket)
  22. # if we link with the module socket in Static, we must link the project with the dependency on win32
  23. IF(WIN32 AND NOT DYNAMIC_LINK_OPENVIBE_MODULE_SOCKET)
  24. INCLUDE("FindThirdPartyWinsock2")
  25. # FIND_LIBRARY(LIB_STANDARD_MODULE_WINSOCK ws2_32)
  26. # IF(LIB_STANDARD_MODULE_WINSOCK)
  27. # debug_message( " Found ws2_32...")
  28. # IF(TARGET ${PROJECT_NAME})
  29. # TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_STANDARD_MODULE_WINSOCK})
  30. # ENDIF()
  31. # IF(TARGET ${PROJECT_NAME}-static)
  32. # TARGET_LINK_LIBRARIES(${PROJECT_NAME}-static ${LIB_STANDARD_MODULE_WINSOCK})
  33. # ENDIF()
  34. # ELSE(LIB_STANDARD_MODULE_WINSOCK)
  35. # debug_message( " FAILED to find ws2_32...")
  36. # ENDIF(LIB_STANDARD_MODULE_WINSOCK)
  37. ENDIF(WIN32 AND NOT DYNAMIC_LINK_OPENVIBE_MODULE_SOCKET)
  38. ELSE(PATH_OPENVIBE_MODULES_SOCKET)
  39. MESSAGE(WARNING " FAILED to find OpenViBE module Socket...")
  40. ENDIF(PATH_OPENVIBE_MODULES_SOCKET)