CMakeLists.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. cmake_minimum_required(VERSION 3.5)
  2. set(this_exe VideoPlayer)
  3. #包含源文件
  4. file(GLOB LOCAL_SRC
  5. ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
  6. ${CMAKE_CURRENT_SOURCE_DIR}/*.rc
  7. ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
  8. ${CMAKE_CURRENT_SOURCE_DIR}/*.ui
  9. ${CMAKE_CURRENT_SOURCE_DIR}/VideoPlayer/*.cpp
  10. ${CMAKE_SOURCE_DIR}/External/common/Logs/*.cpp
  11. ${CMAKE_SOURCE_DIR}/External/common/ThreadPool/*.cpp
  12. )
  13. # 生成可执行程序
  14. add_executable(${this_exe}
  15. # WIN32
  16. ${GLOBAL_SRC}
  17. ${LOCAL_SRC}
  18. )
  19. # set_target_properties(${this_exe} PROPERTIES
  20. # )
  21. #添加头文件
  22. target_include_directories(${this_exe} PRIVATE
  23. ${CMAKE_CURRENT_SOURCE_DIR}
  24. ${CMAKE_CURRENT_SOURCE_DIR}/VideoPlayer
  25. ${CMAKE_SOURCE_DIR}/External/common
  26. ${CMAKE_SOURCE_DIR}/External/common/FmtLog
  27. ${CMAKE_SOURCE_DIR}/External/common/ThreadPool
  28. ${CMAKE_SOURCE_DIR}/External/common/RingQueue
  29. ${CURL_INCLUDE_DIR}
  30. ${FFMPEG_INCLUDE_DIR}
  31. )
  32. target_link_libraries(${this_exe} PRIVATE
  33. Qt5::Widgets
  34. Qt5::Core
  35. Qt5::Network
  36. # Qt5::Multimedia
  37. # Qt5::Xml
  38. # Qt5::Sql
  39. )
  40. target_link_libraries(${this_exe} PRIVATE
  41. fmt::fmt
  42. spdlog::spdlog
  43. ${CURL_LIBRARY}
  44. ${FFMPEG_LIBRARY}
  45. )
  46. if(CMAKE_CXX_COMPILER_VERSION LESS 9.0)
  47. target_link_libraries(${this_exe} PRIVATE
  48. stdc++fs
  49. )
  50. endif()
  51. # target_link_libraries(${this_exe} PRIVATE
  52. # ${CURL_LIBRARY}
  53. # )
  54. # message(STATUS "CURL_LIBRARY: ${CURL_LIBRARY}")
  55. # if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
  56. # target_link_libraries(${this_exe} PRIVATE
  57. # # debug spdlogd.lib
  58. # # optimized spdlog.lib
  59. # )
  60. # elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU)
  61. # target_link_libraries(${this_exe} PRIVATE
  62. # # debug
  63. # # optimized ${SM_DLL}
  64. # )
  65. # endif()