Add compatibility to vcpkg buildsystem (#8317)
[oweals/minetest.git] / cmake / Modules / FindIrrlicht.cmake
index 37349b892b9b3f0b2ea94d92418ce83a6891a7b1..6f361e82966d582fdf2590c95f3c6beaa018c132 100644 (file)
@@ -43,6 +43,7 @@ else()
                /usr/local/include/irrlicht
                /usr/include/irrlicht
                /system/develop/headers/irrlicht #Haiku
+               PATH_SUFFIXES "include/irrlicht"
        )
 
        find_library(IRRLICHT_LIBRARY NAMES libIrrlicht.so libIrrlicht.a Irrlicht
@@ -56,16 +57,19 @@ endif()
 
 # On Windows, find the DLL for installation
 if(WIN32)
-       if(MSVC)
-               set(IRRLICHT_COMPILER "VisualStudio")
-       else()
-               set(IRRLICHT_COMPILER "gcc")
+       # If VCPKG_APPLOCAL_DEPS is ON, dll's are automatically handled by VCPKG
+       if(NOT VCPKG_APPLOCAL_DEPS)
+               if(MSVC)
+                       set(IRRLICHT_COMPILER "VisualStudio")
+               else()
+                       set(IRRLICHT_COMPILER "gcc")
+               endif()
+               find_file(IRRLICHT_DLL NAMES Irrlicht.dll
+                       PATHS
+                       "${IRRLICHT_SOURCE_DIR}/bin/Win32-${IRRLICHT_COMPILER}"
+                       DOC "Path of the Irrlicht dll (for installation)"
+               )
        endif()
-       find_file(IRRLICHT_DLL NAMES Irrlicht.dll
-               PATHS
-               "${IRRLICHT_SOURCE_DIR}/bin/Win32-${IRRLICHT_COMPILER}"
-               DOC "Path of the Irrlicht dll (for installation)"
-       )
 endif(WIN32)
 
 include(FindPackageHandleStandardArgs)