CMakeLists.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. cmake_minimum_required(VERSION 3.12)
  2. #设置可执行文件名称
  3. set(execName1 show1)
  4. #包含源文件
  5. file(GLOB LOCAL_SRC
  6. ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
  7. ${CMAKE_CURRENT_SOURCE_DIR}/*.ui
  8. ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
  9. ${CMAKE_CURRENT_SOURCE_DIR}/StyleManager/*.cpp
  10. ${CMAKE_SOURCE_DIR}/External/common/Thread/*.cpp
  11. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/*.cpp
  12. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/WebAPI/*.cpp
  13. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/Resource/*.qrc
  14. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/WidgetItems/*.cpp
  15. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/UserData/*.cpp
  16. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/AddItem/*.cpp
  17. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/ItemData/*.cpp
  18. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/Template/*.cpp
  19. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/warnning/*.cpp
  20. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/Shadow/*.cpp
  21. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/ImageBlur/*.cpp
  22. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/combobox/*.cpp
  23. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/SelectTime/*.cpp
  24. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/date/*.cpp
  25. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/date/*.qrc
  26. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/DropShadow/*.cpp
  27. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/PaintHelper/*.cpp
  28. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/warning/*.cpp
  29. # ${LHQLog_SOURCE_DIRS}/*.cpp
  30. ${LHHTTPAPI_SOURCE_DIRS}/*.cpp
  31. )
  32. # message(STATUS "LHQLog_SOURCE_DIRS: ${LHQLog_SOURCE_DIRS}")
  33. # message(STATUS "LHHTTPAPI_SOURCE_DIRS: ${LHHTTPAPI_SOURCE_DIRS}")
  34. #生成可执行程序
  35. add_executable(${execName1} ${LOCAL_SRC})
  36. #添加头文件
  37. target_include_directories(${execName1} PRIVATE
  38. ${CMAKE_CURRENT_SOURCE_DIR}
  39. ${CMAKE_CURRENT_SOURCE_DIR}/LHLog
  40. ${CMAKE_CURRENT_SOURCE_DIR}/StyleManager
  41. ${CMAKE_SOURCE_DIR}/External/common/Thread
  42. ${CMAKE_SOURCE_DIR}/TransmitterSwitch
  43. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/WebAPI
  44. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/WidgetItems
  45. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/UserData
  46. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/AddItem
  47. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/ItemData
  48. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/Template
  49. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/warnning
  50. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common
  51. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/nlohmann
  52. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/Shadow
  53. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/ImageBlur
  54. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/combobox
  55. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/SelectTime
  56. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/date
  57. ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/warning
  58. # ${LHQLog_INCLUDE_DIRS}
  59. ${LHHTTPAPI_INCLUDE_DIRS}
  60. ${spdlog_INCLUDE_DIR}
  61. )
  62. #链接Qt库
  63. target_link_libraries(${execName1} PRIVATE
  64. Qt5::Widgets
  65. Qt5::Core
  66. Qt5::Network
  67. )
  68. #链接外部库
  69. target_link_libraries(${execName1} PRIVATE
  70. ${spdlog_LIBRARY}
  71. )
  72. #连接stdc++fs库,如果编译器版本低于GCC9.0,则需要连接这个库
  73. #GCC9.0以上包含进了标准库
  74. # if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  75. # if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
  76. # target_link_libraries(${execName1} PRIVATE stdc++fs)
  77. # endif()
  78. # endif()