CMakeLists.txt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. cmake_minimum_required(VERSION 2.8.0)
  2. project(mumlib)
  3. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  4. add_definitions(-DOPT_TLS_GNUTLS -D_POSIX_C_SOURCE=200112L)
  5. INCLUDE(FindPkgConfig)
  6. find_package(PkgConfig REQUIRED)
  7. find_package(Boost COMPONENTS system REQUIRED)
  8. find_package(OpenSSL REQUIRED)
  9. find_package(Protobuf REQUIRED)
  10. pkg_check_modules(LOG4CPP "log4cpp")
  11. pkg_check_modules(OPUS "opus")
  12. INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
  13. include_directories(${OPENSSL_INCLUDE_DIR})
  14. include_directories(${PROTOBUF_INCLUDE_DIRS})
  15. include_directories(${OPUS_INCLUDE_DIRS})
  16. include_directories(${CMAKE_CURRENT_BINARY_DIR})
  17. include_directories(${LOG4CPP_INCLUDE_DIRS})
  18. include_directories(include)
  19. set(MUMLIB_PUBLIC_HEADERS include/mumlib.hpp include/mumlib/VarInt.hpp)
  20. set(MUMLIB_PRIVATE_HEADERS
  21. include/mumlib/Callback.hpp
  22. include/mumlib/CryptState.hpp
  23. include/mumlib/Transport.hpp
  24. include/mumlib/Audio.hpp
  25. include/mumlib/enums.hpp
  26. )
  27. set(MUMLIB_SRC
  28. src/mumlib.cpp
  29. src/Callback.cpp
  30. src/CryptState.cpp
  31. src/VarInt.cpp
  32. src/Transport.cpp
  33. src/Audio.cpp
  34. )
  35. PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS Mumble.proto)
  36. add_library(mumlib SHARED ${MUMLIB_SRC} ${MUMLIB_PUBLIC_HEADERS} ${MUMLIB_PRIVATE_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS})
  37. target_link_libraries(mumlib ${PROTOBUF_LIBRARIES})
  38. target_link_libraries(mumlib ${Boost_LIBRARIES})
  39. target_link_libraries(mumlib ${OPENSSL_LIBRARIES})
  40. target_link_libraries(mumlib ${LOG4CPP_LIBRARIES})
  41. target_link_libraries(mumlib ${OPUS_LIBRARIES})
  42. add_executable(mumlib_example mumlib_example.cpp)
  43. target_link_libraries(mumlib_example mumlib)