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.

CMakeLists.txt 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. PROJECT(openvibe-module-socket)
  2. SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
  3. SET(PROJECT_VERSION_MINOR ${OV_GLOBAL_VERSION_MINOR})
  4. SET(PROJECT_VERSION_PATCH ${OV_GLOBAL_VERSION_PATCH})
  5. SET(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
  6. FILE(GLOB_RECURSE SRC_FILES src/*.cpp src/*.h src/*.hpp src/*.inl include/*.h include/*.hpp)
  7. INCLUDE_DIRECTORIES(include/socket)
  8. INCLUDE("FindSourceRCProperties")
  9. ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRC_FILES})
  10. SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
  11. VERSION ${PROJECT_VERSION}
  12. SOVERSION ${PROJECT_VERSION_MAJOR}
  13. FOLDER ${MODULES_FOLDER}
  14. COMPILE_FLAGS "-DSocket_Shared -DSocket_Exports")
  15. ADD_LIBRARY(${PROJECT_NAME}-static STATIC ${SRC_FILES})
  16. SET_TARGET_PROPERTIES(${PROJECT_NAME}-static PROPERTIES
  17. VERSION ${PROJECT_VERSION}
  18. SOVERSION ${PROJECT_VERSION_MAJOR}
  19. FOLDER ${MODULES_FOLDER}
  20. COMPILE_FLAGS "-DSocket_Static -DSocket_Exports")
  21. IF(UNIX)
  22. SET_PROPERTY(TARGET ${PROJECT_NAME}-static APPEND_STRING PROPERTY COMPILE_FLAGS " -fPIC")
  23. ELSEIF(WIN32)
  24. # SET_PROPERTY(TARGET ${PROJECT_NAME}-static APPEND_STRING PROPERTY COMPILE_FLAGS " /SAFESEH:NO")
  25. # SET_PROPERTY(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS " /SAFESEH:NO")
  26. ENDIF()
  27. INCLUDE("FindOpenViBECommon")
  28. #INCLUDE("FindThirdPartyTVicPort")
  29. # ---------------------------------
  30. # Finds standard library winsock
  31. # Adds library to target
  32. # Adds include path
  33. # ---------------------------------
  34. IF(WIN32)
  35. INCLUDE("OvSetWindowsSDKPath")
  36. FIND_LIBRARY(LIB_STANDARD_MODULE_WINSOCK ws2_32 ${OV_MS_SDK_PATH}/lib)
  37. IF(LIB_STANDARD_MODULE_WINSOCK)
  38. MESSAGE(STATUS " Found ws2_32...")
  39. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_STANDARD_MODULE_WINSOCK})
  40. TARGET_LINK_LIBRARIES(${PROJECT_NAME}-static ${LIB_STANDARD_MODULE_WINSOCK})
  41. ELSE(LIB_STANDARD_MODULE_WINSOCK)
  42. MESSAGE(STATUS " FAILED to find ws2_32...")
  43. ENDIF(LIB_STANDARD_MODULE_WINSOCK)
  44. ENDIF(WIN32)
  45. # ---------------------------------
  46. # Target macros
  47. # Defines target operating system, architecture and compiler
  48. # ---------------------------------
  49. SET_BUILD_PLATFORM()
  50. # -----------------------------
  51. # Install files
  52. # -----------------------------
  53. INSTALL(TARGETS ${PROJECT_NAME}
  54. RUNTIME DESTINATION ${DIST_BINDIR}
  55. LIBRARY DESTINATION ${DIST_LIBDIR}
  56. ARCHIVE DESTINATION ${DIST_LIBDIR})
  57. INSTALL(TARGETS ${PROJECT_NAME}-static
  58. RUNTIME DESTINATION ${DIST_BINDIR}
  59. LIBRARY DESTINATION ${DIST_LIBDIR}
  60. ARCHIVE DESTINATION ${DIST_LIBDIR})
  61. INSTALL(DIRECTORY include/ DESTINATION ${DIST_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")