CMakeLists.txt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. cmake_minimum_required(VERSION 3.5)
  2. set(this_exe curlFtp)
  3. #包含源文件
  4. file(GLOB LOCAL_SRC
  5. ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
  6. ${CMAKE_CURRENT_SOURCE_DIR}/*.rc
  7. ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
  8. ${CMAKE_CURRENT_SOURCE_DIR}/*.ui
  9. ${CMAKE_SOURCE_DIR}/External/common/http/*.cpp
  10. ${CMAKE_SOURCE_DIR}/External/common/LightLog/*.cpp
  11. ${CMAKE_SOURCE_DIR}/External/common/Logs/*.cpp
  12. ${CMAKE_SOURCE_DIR}/External/common/ftp/*.cpp
  13. ${CMAKE_SOURCE_DIR}/External/common/CurlFtp/*.cpp
  14. )
  15. # 生成可执行程序
  16. add_executable(${this_exe}
  17. # WIN32
  18. ${GLOBAL_SRC}
  19. ${LOCAL_SRC}
  20. )
  21. #添加头文件
  22. target_include_directories(${this_exe} PRIVATE
  23. ${CMAKE_CURRENT_SOURCE_DIR}
  24. ${CMAKE_SOURCE_DIR}/External/common
  25. ${CMAKE_SOURCE_DIR}/External/common/http
  26. ${CMAKE_SOURCE_DIR}/External/common/LightLog
  27. ${CMAKE_SOURCE_DIR}/External/common/Logs
  28. ${CMAKE_SOURCE_DIR}/External/common/ftp
  29. ${CMAKE_SOURCE_DIR}/External/common/CurlFtp
  30. ${CMAKE_SOURCE_DIR}/External/common/FmtLog
  31. )
  32. target_link_libraries(${this_exe} PRIVATE
  33. Qt5::Widgets
  34. Qt5::Core
  35. Qt5::Network
  36. # Qt5::Multimedia
  37. # Qt5::Xml
  38. # Qt5::Sql
  39. )
  40. target_link_libraries(${this_exe} PRIVATE
  41. fmt::fmt
  42. spdlog::spdlog
  43. ${CURL_LIBRARY}
  44. )
  45. if(CMAKE_CXX_COMPILER_VERSION LESS 9.0)
  46. target_link_libraries(${this_exe} PRIVATE
  47. stdc++fs
  48. )
  49. endif()
  50. # target_link_libraries(${this_exe} PRIVATE
  51. # ${CURL_LIBRARY}
  52. # )
  53. # message(STATUS "CURL_LIBRARY: ${CURL_LIBRARY}")
  54. # if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
  55. # target_link_libraries(${this_exe} PRIVATE
  56. # # debug spdlogd.lib
  57. # # optimized spdlog.lib
  58. # )
  59. # elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU)
  60. # target_link_libraries(${this_exe} PRIVATE
  61. # # debug
  62. # # optimized ${SM_DLL}
  63. # )
  64. # endif()