CMakeLists.txt 3.1 KB

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