CMakeLists.txt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/http
  25. ${CMAKE_SOURCE_DIR}/External/common/LightLog
  26. ${CMAKE_SOURCE_DIR}/External/common/Logs
  27. ${CMAKE_SOURCE_DIR}/External/common/ftp
  28. ${CMAKE_SOURCE_DIR}/External/common/CurlFtp
  29. ${CMAKE_SOURCE_DIR}/External/common/FmtLog
  30. )
  31. target_link_libraries(${this_exe} PRIVATE
  32. Qt5::Widgets
  33. Qt5::Core
  34. Qt5::Network
  35. # Qt5::Multimedia
  36. # Qt5::Xml
  37. # Qt5::Sql
  38. )
  39. target_link_libraries(${this_exe} PRIVATE
  40. fmt::fmt
  41. spdlog::spdlog
  42. CURL::libcurl
  43. )
  44. if(CMAKE_CXX_COMPILER_VERSION LESS 9.0)
  45. target_link_libraries(${this_exe} PRIVATE
  46. stdc++fs
  47. )
  48. endif()
  49. # target_link_libraries(${this_exe} PRIVATE
  50. # ${CURL_LIBRARY}
  51. # )
  52. # message(STATUS "CURL_LIBRARY: ${CURL_LIBRARY}")
  53. # if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
  54. # target_link_libraries(${this_exe} PRIVATE
  55. # # debug spdlogd.lib
  56. # # optimized spdlog.lib
  57. # )
  58. # elseif(CMAKE_CXX_COMPILER_ID MATCHES GNU)
  59. # target_link_libraries(${this_exe} PRIVATE
  60. # # debug
  61. # # optimized ${SM_DLL}
  62. # )
  63. # endif()