CMakeLists.txt 3.5 KB

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