FindIrrlicht.cmake 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #FindIrrlicht.cmake
  2. set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)")
  3. if( UNIX )
  4. # Unix
  5. else( UNIX )
  6. # Windows
  7. endif( UNIX )
  8. # Find include directory
  9. if(NOT IRRLICHT_SOURCE_DIR STREQUAL "")
  10. set(IRRLICHT_SOURCE_DIR_INCLUDE
  11. "${IRRLICHT_SOURCE_DIR}/include"
  12. )
  13. set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a Irrlicht Irrlicht.lib)
  14. if(WIN32)
  15. if(MSVC)
  16. set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio")
  17. set(IRRLICHT_LIBRARY_NAMES Irrlicht.lib)
  18. else()
  19. set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc")
  20. set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a libIrrlicht.dll.a)
  21. endif()
  22. else()
  23. set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Linux")
  24. set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a)
  25. endif()
  26. FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
  27. PATHS
  28. ${IRRLICHT_SOURCE_DIR_INCLUDE}
  29. NO_DEFAULT_PATH
  30. )
  31. FIND_LIBRARY(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES}
  32. PATHS
  33. ${IRRLICHT_SOURCE_DIR_LIBS}
  34. NO_DEFAULT_PATH
  35. )
  36. else()
  37. FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
  38. PATHS
  39. /usr/local/include/irrlicht
  40. /usr/include/irrlicht
  41. )
  42. FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht
  43. PATHS
  44. /usr/local/lib
  45. /usr/lib
  46. )
  47. endif()
  48. MESSAGE(STATUS "IRRLICHT_SOURCE_DIR = ${IRRLICHT_SOURCE_DIR}")
  49. MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}")
  50. MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}")
  51. # On windows, find the dll for installation
  52. if(WIN32)
  53. if(MSVC)
  54. FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
  55. PATHS
  56. "${IRRLICHT_SOURCE_DIR}/bin/Win32-VisualStudio"
  57. DOC "Path of the Irrlicht dll (for installation)"
  58. )
  59. else()
  60. FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
  61. PATHS
  62. "${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc"
  63. DOC "Path of the Irrlicht dll (for installation)"
  64. )
  65. endif()
  66. MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}")
  67. endif(WIN32)
  68. # handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if
  69. # all listed variables are TRUE
  70. INCLUDE(FindPackageHandleStandardArgs)
  71. FIND_PACKAGE_HANDLE_STANDARD_ARGS(IRRLICHT DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
  72. IF(IRRLICHT_FOUND)
  73. SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY})
  74. ELSE(IRRLICHT_FOUND)
  75. SET(IRRLICHT_LIBRARIES)
  76. ENDIF(IRRLICHT_FOUND)
  77. MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL)