diff options
author | JosiahWI <41302989+JosiahWI@users.noreply.github.com> | 2021-07-27 12:11:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-27 19:11:27 +0200 |
commit | cf136914cf421ee52f6806eda2fa97740d0ee552 (patch) | |
tree | 1068c357c835cad165204d29771df5d1793c89a5 /cmake/Modules/MinetestFindIrrlichtHeaders.cmake | |
parent | 216728cc5e83ff6c4f13a52821ff3c24b1e315e9 (diff) | |
download | minetest-cf136914cf421ee52f6806eda2fa97740d0ee552.tar.gz minetest-cf136914cf421ee52f6806eda2fa97740d0ee552.tar.bz2 minetest-cf136914cf421ee52f6806eda2fa97740d0ee552.zip |
Take advantage of IrrlichtMt CMake target (#11287)
With the CMake changes to IrrlichtMt, it's now possible to use a target for IrrlichtMt.
Besides greatly improving the ease of setting up IrrlichtMt for users building the client, it removes the need for Minetest's CMake to include transitive dependencies such as image libraries, cleaning it up a tiny bit. The PR works by finding the IrrlichtMt package and linking to the target it provides. If the package isn't found and it isn't building the client, it will still fall back to using just the headers of old Irrlicht or IrrlichtMt.
Diffstat (limited to 'cmake/Modules/MinetestFindIrrlichtHeaders.cmake')
-rw-r--r-- | cmake/Modules/MinetestFindIrrlichtHeaders.cmake | 26 |
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() |