CMakeLists.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. cmake_minimum_required(VERSION 3.5)
  2. set(this_exe timer)
  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_SOURCE_DIR}/External/common/LightLog/*.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. #添加头文件
  20. target_include_directories(${this_exe} PRIVATE
  21. ${CMAKE_CURRENT_SOURCE_DIR}
  22. ${CMAKE_SOURCE_DIR}/External/common/LightLog
  23. ${CMAKE_SOURCE_DIR}/External/common
  24. ${CMAKE_SOURCE_DIR}/External/common/FmtLog
  25. ${CMAKE_SOURCE_DIR}/External/common/Timer
  26. ${CMAKE_SOURCE_DIR}/External/common/ThreadPool
  27. ${CMAKE_SOURCE_DIR}/External/common/RingQueue
  28. )
  29. target_link_libraries(${this_exe} PRIVATE
  30. Qt5::Widgets
  31. Qt5::Core
  32. Qt5::Network
  33. # Qt5::Multimedia
  34. # Qt5::Xml
  35. # Qt5::Sql
  36. )
  37. target_link_libraries(${this_exe} PRIVATE
  38. fmt::fmt
  39. spdlog::spdlog
  40. ${CURL_LIBRARY}
  41. )
  42. if(CMAKE_CXX_COMPILER_VERSION LESS 9.0)
  43. target_link_libraries(${this_exe} PRIVATE
  44. stdc++fs
  45. )
  46. endif()
  47. # target_link_libraries(${this_exe} PRIVATE
  48. # ${CURL_LIBRARY}
  49. # )
  50. # message(STATUS "CURL_LIBRARY: ${CURL_LIBRARY}")
  51. # if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
  52. # target_link_libraries(${this_exe} PRIVATE
  53. # # debug spdlogd.lib
  54. # # optimized spdlog.lib
  55. # )
  56. # elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU)
  57. # target_link_libraries(${this_exe} PRIVATE
  58. # # debug
  59. # # optimized ${SM_DLL}
  60. # )
  61. # endif()