aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/MinetestFindIrrlichtHeaders.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/Modules/MinetestFindIrrlichtHeaders.cmake')
-rw-r--r--cmake/Modules/MinetestFindIrrlichtHeaders.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/cmake/Modules/MinetestFindIrrlichtHeaders.cmake b/cmake/Modules/MinetestFindIrrlichtHeaders.cmake
new file mode 100644
index 000000000..d33b296d0
--- /dev/null
+++ b/cmake/Modules/MinetestFindIrrlichtHeaders.cmake
@@ -0,0 +1,26 @@
+# Locate Irrlicht or IrrlichtMt headers on system.
+
+foreach(libname IN ITEMS IrrlichtMt Irrlicht)
+ string(TOLOWER "${libname}" libname2)
+
+ find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
+ DOC "Path to the directory with IrrlichtMt includes"
+ PATHS
+ /usr/local/include/${libname2}
+ /usr/include/${libname2}
+ /system/develop/headers/${libname2} #Haiku
+ PATH_SUFFIXES "include/${libname2}"
+ )
+
+ if(IRRLICHT_INCLUDE_DIR)
+ break()
+ endif()
+endforeach()
+
+# Handholding for users
+if(IRRLICHT_INCLUDE_DIR AND (NOT IS_DIRECTORY "${IRRLICHT_INCLUDE_DIR}" OR
+ NOT EXISTS "${IRRLICHT_INCLUDE_DIR}/irrlicht.h"))
+ message(WARNING "IRRLICHT_INCLUDE_DIR was set to ${IRRLICHT_INCLUDE_DIR} "
+ "but irrlicht.h does not exist inside. The path will not be used.")
+ unset(IRRLICHT_INCLUDE_DIR CACHE)
+endif()