CMakeLists.txt 2.9 KB

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