CMakeLists.txt 2.6 KB

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