2
0

deps.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. include_guard(GLOBAL)
  2. include(deps_install)
  3. set(PRINT_DEPS_INFO ON CACHE BOOL "Print deps info.") # 默认设定为 ON
  4. set(_print ${PRINT_DEPS_INFO})
  5. set(DEPS_FOUND TRUE)
  6. if (WIN32 AND NOT CYGWIN) # cygwin 不依赖 dl
  7. find_package(dlfcn-win32 QUIET)
  8. if (NOT dlfcn-win32_FOUND)
  9. set(DEPS_FOUND FALSE)
  10. message(WARNING "dlfcn-win32 not found. But you can try install it by the cmake program.")
  11. else()
  12. set(dlfcn_lib dlfcn-win32::dl)
  13. wi_install_import(TARGETS dlfcn-win32::dl)
  14. endif()
  15. else()
  16. set(DLFCN_AUTO_FIND FALSE CACHE BOOL "dlfcn auto find by compiler.")
  17. set(DLFCN_ROOT "" CACHE STRING "The directory of dl.")
  18. set(dlfcn_root ${DLFCN_ROOT})
  19. if (dlfcn_root)
  20. find_library(dlfcn_path dl HINTS ${dlfcn_root})
  21. else()
  22. find_library(dlfcn_path dl)
  23. endif()
  24. if (NOT dlfcn_path)
  25. if (DLFCN_AUTO_FIND)
  26. set(dlfcn_path "")
  27. else()
  28. set(DEPS_FOUND FALSE)
  29. message(SEND_ERROR "dlfcn not found.")
  30. endif()
  31. endif()
  32. unset(dlfcn_root)
  33. set(dlfcn_lib ${dlfcn_path})
  34. endif()
  35. find_package(PCRE2 COMPONENTS 8BIT QUIET)
  36. if (NOT PCRE2_FOUND)
  37. set(DEPS_FOUND FALSE)
  38. message(WARNING "PCRE2 8BIT not found. But you can try install it by the cmake program.")
  39. else()
  40. wi_install_import(TARGETS PCRE2::8BIT)
  41. endif()
  42. find_package(Threads QUIET)
  43. if (NOT Threads_FOUND)
  44. set(DEPS_FOUND FALSE)
  45. message(SEND_ERROR "Threads library not found.")
  46. else()
  47. wi_install_import(TARGETS Threads::Threads)
  48. endif()