Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

79 строки
2.5 KiB

  1. # - Try to find raylib
  2. # Options:
  3. # raylib_USE_STATIC_LIBS - OFF by default
  4. # raylib_VERBOSE - OFF by default
  5. # Once done, this defines a raylib target that can be passed to
  6. # target_link_libraries as well as following variables:
  7. #
  8. # raylib_FOUND - System has raylib installed
  9. # raylib_INCLUDE_DIRS - The include directories for the raylib header(s)
  10. # raylib_LIBRARIES - The libraries needed to use raylib
  11. # raylib_LDFLAGS - The linker flags needed with raylib
  12. # raylib_DEFINITIONS - Compiler switches required for using raylib
  13. if (NOT TARGET raylib)
  14. set(XPREFIX PC_RAYLIB)
  15. find_package(PkgConfig QUIET)
  16. pkg_check_modules(${XPREFIX} QUIET raylib)
  17. if (raylib_USE_STATIC_LIBS)
  18. set(XPREFIX ${XPREFIX}_STATIC)
  19. endif()
  20. set(raylib_DEFINITIONS ${${XPREFIX}_CFLAGS})
  21. find_path(raylib_INCLUDE_DIR
  22. NAMES raylib.h
  23. HINTS ${${XPREFIX}_INCLUDE_DIRS}
  24. )
  25. set(RAYLIB_NAMES raylib)
  26. if (raylib_USE_STATIC_LIBS)
  27. set(RAYLIB_NAMES libraylib.a raylib.lib ${RAYLIB_NAMES})
  28. endif()
  29. find_library(raylib_LIBRARY
  30. NAMES ${RAYLIB_NAMES}
  31. HINTS ${${XPREFIX}_LIBRARY_DIRS}
  32. )
  33. set(raylib_LIBRARIES ${raylib_LIBRARY})
  34. set(raylib_LIBRARY_DIRS ${${XPREFIX}_LIBRARY_DIRS})
  35. set(raylib_LIBRARY_DIR ${raylib_LIBRARY_DIRS})
  36. set(raylib_INCLUDE_DIRS ${raylib_INCLUDE_DIR})
  37. set(raylib_LDFLAGS ${${XPREFIX}_LDFLAGS})
  38. include(FindPackageHandleStandardArgs)
  39. find_package_handle_standard_args(raylib DEFAULT_MSG
  40. raylib_LIBRARY
  41. raylib_INCLUDE_DIR
  42. )
  43. mark_as_advanced(raylib_LIBRARY raylib_INCLUDE_DIR)
  44. if (raylib_USE_STATIC_LIBS)
  45. add_library(raylib STATIC IMPORTED GLOBAL)
  46. else()
  47. add_library(raylib SHARED IMPORTED GLOBAL)
  48. endif()
  49. string (REPLACE ";" " " raylib_LDFLAGS "${raylib_LDFLAGS}")
  50. set_target_properties(raylib
  51. PROPERTIES
  52. IMPORTED_LOCATION "${raylib_LIBRARIES}"
  53. IMPORTED_IMPLIB "${raylib_LIBRARIES}"
  54. INTERFACE_INCLUDE_DIRECTORIES "${raylib_INCLUDE_DIRS}"
  55. INTERFACE_LINK_LIBRARIES "${raylib_LDFLAGS}"
  56. INTERFACE_COMPILE_OPTIONS "${raylib_DEFINITIONS}"
  57. )
  58. if (raylib_VERBOSE)
  59. message(STATUS "raylib_FOUND: ${raylib_FOUND}")
  60. message(STATUS "raylib_INCLUDE_DIRS: ${raylib_INCLUDE_DIRS}")
  61. message(STATUS "raylib_LIBRARIES: ${raylib_LIBRARIES}")
  62. message(STATUS "raylib_LDFLAGS: ${raylib_LDFLAGS}")
  63. message(STATUS "raylib_DEFINITIONS: ${raylib_DEFINITIONS}")
  64. endif()
  65. endif()