2011-01-08 16:34:25 +01:00
|
|
|
|
2021-04-28 08:38:18 +02:00
|
|
|
mark_as_advanced(IRRLICHT_DLL)
|
2011-01-08 16:34:25 +01:00
|
|
|
|
2021-02-18 14:50:47 +01:00
|
|
|
# Find include directory and libraries
|
2015-02-28 00:05:29 +01:00
|
|
|
|
2021-03-25 15:09:49 +01:00
|
|
|
# find our fork first, then upstream (TODO: remove this?)
|
|
|
|
foreach(libname IN ITEMS IrrlichtMt Irrlicht)
|
|
|
|
string(TOLOWER "${libname}" libname2)
|
|
|
|
|
2015-02-28 00:05:29 +01:00
|
|
|
find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
|
2021-03-25 15:09:49 +01:00
|
|
|
DOC "Path to the directory with IrrlichtMt includes"
|
2011-02-16 08:43:04 +01:00
|
|
|
PATHS
|
2021-03-25 15:09:49 +01:00
|
|
|
/usr/local/include/${libname2}
|
|
|
|
/usr/include/${libname2}
|
|
|
|
/system/develop/headers/${libname2} #Haiku
|
|
|
|
PATH_SUFFIXES "include/${libname2}"
|
2011-02-16 08:43:04 +01:00
|
|
|
)
|
2011-01-08 02:10:20 +01:00
|
|
|
|
2021-03-25 15:09:49 +01:00
|
|
|
find_library(IRRLICHT_LIBRARY NAMES lib${libname} ${libname}
|
|
|
|
DOC "Path to the IrrlichtMt library file"
|
2011-02-16 08:43:04 +01:00
|
|
|
PATHS
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/lib
|
2017-10-30 08:17:43 +01:00
|
|
|
/system/develop/lib # Haiku
|
2011-02-16 08:43:04 +01:00
|
|
|
)
|
2021-03-25 15:09:49 +01:00
|
|
|
|
|
|
|
if(IRRLICHT_INCLUDE_DIR OR IRRLICHT_LIBRARY)
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2011-01-08 02:10:20 +01:00
|
|
|
|
2021-04-28 08:38:18 +02:00
|
|
|
# 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()
|
|
|
|
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux" OR APPLE)
|
|
|
|
# (only on systems where we're sure how a valid library looks like)
|
2021-06-05 13:36:52 +02:00
|
|
|
if(IRRLICHT_LIBRARY AND (NOT EXISTS "${IRRLICHT_LIBRARY}" OR
|
2021-04-28 08:38:18 +02:00
|
|
|
NOT IRRLICHT_LIBRARY MATCHES "\\.(a|so|dylib|lib)([.0-9]+)?$"))
|
|
|
|
message(WARNING "IRRLICHT_LIBRARY was set to ${IRRLICHT_LIBRARY} "
|
|
|
|
"but is not a valid library file. The path will not be used.")
|
|
|
|
unset(IRRLICHT_LIBRARY CACHE)
|
|
|
|
endif()
|
|
|
|
endif()
|
2011-01-08 02:10:20 +01:00
|
|
|
|
2015-02-28 00:05:29 +01:00
|
|
|
# On Windows, find the DLL for installation
|
2011-01-08 16:34:25 +01:00
|
|
|
if(WIN32)
|
2019-06-10 03:56:55 +02:00
|
|
|
# If VCPKG_APPLOCAL_DEPS is ON, dll's are automatically handled by VCPKG
|
|
|
|
if(NOT VCPKG_APPLOCAL_DEPS)
|
2021-03-25 15:09:49 +01:00
|
|
|
find_file(IRRLICHT_DLL NAMES IrrlichtMt.dll
|
|
|
|
DOC "Path of the IrrlichtMt dll (for installation)"
|
2019-06-10 03:56:55 +02:00
|
|
|
)
|
2011-01-08 16:34:25 +01:00
|
|
|
endif()
|
|
|
|
endif(WIN32)
|
|
|
|
|
2015-02-28 00:05:29 +01:00
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
|
2011-01-08 02:10:20 +01:00
|
|
|
|