FindIrrlicht.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. mark_as_advanced(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL)
  2. set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)")
  3. # Find include directory
  4. if(NOT IRRLICHT_SOURCE_DIR STREQUAL "")
  5. set(IRRLICHT_SOURCE_DIR_INCLUDE
  6. "${IRRLICHT_SOURCE_DIR}/include"
  7. )
  8. set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a Irrlicht Irrlicht.lib)
  9. if(WIN32)
  10. if(MSVC)
  11. set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio")
  12. set(IRRLICHT_LIBRARY_NAMES Irrlicht.lib)
  13. else()
  14. set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc")
  15. set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a libIrrlicht.dll.a)
  16. endif()
  17. else()
  18. set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Linux")
  19. set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a)
  20. endif()
  21. find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
  22. PATHS
  23. ${IRRLICHT_SOURCE_DIR_INCLUDE}
  24. NO_DEFAULT_PATH
  25. )
  26. find_library(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES}
  27. PATHS
  28. ${IRRLICHT_SOURCE_DIR_LIBS}
  29. NO_DEFAULT_PATH
  30. )
  31. else()
  32. find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
  33. PATHS
  34. /usr/local/include/irrlicht
  35. /usr/include/irrlicht
  36. /system/develop/headers/irrlicht #Haiku
  37. PATH_SUFFIXES "include/irrlicht"
  38. )
  39. find_library(IRRLICHT_LIBRARY NAMES libIrrlicht.so libIrrlicht.a Irrlicht
  40. PATHS
  41. /usr/local/lib
  42. /usr/lib
  43. /system/develop/lib # Haiku
  44. )
  45. endif()
  46. # On Windows, find the DLL for installation
  47. if(WIN32)
  48. # If VCPKG_APPLOCAL_DEPS is ON, dll's are automatically handled by VCPKG
  49. if(NOT VCPKG_APPLOCAL_DEPS)
  50. if(MSVC)
  51. set(IRRLICHT_COMPILER "VisualStudio")
  52. else()
  53. set(IRRLICHT_COMPILER "gcc")
  54. endif()
  55. find_file(IRRLICHT_DLL NAMES Irrlicht.dll
  56. PATHS
  57. "${IRRLICHT_SOURCE_DIR}/bin/Win32-${IRRLICHT_COMPILER}"
  58. DOC "Path of the Irrlicht dll (for installation)"
  59. )
  60. endif()
  61. endif(WIN32)
  62. include(FindPackageHandleStandardArgs)
  63. find_package_handle_standard_args(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)