summaryrefslogtreecommitdiff
path: root/cmake/Modules/FindIrrlicht.cmake
blob: 01e7088c9fb0f7ed3bc524050fbab9251b3c0a97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#FindIrrlicht.cmake

set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)")

if( UNIX )
	# Unix
else( UNIX )
	# Windows
endif( UNIX )

# Find include directory

if(NOT IRRLICHT_SOURCE_DIR STREQUAL "")
	set(IRRLICHT_SOURCE_DIR_INCLUDE
		"${IRRLICHT_SOURCE_DIR}/include"
	)
	set(IRRLICHT_SOURCE_DIR_LIBS
		"${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio"
		"${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc"
	)
endif()

FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
	PATHS
	"${IRRLICHT_SOURCE_DIR_INCLUDE}"
	/usr/local/include/irrlicht
	/usr/include/irrlicht
)

# Find library directory

FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht
	PATHS
	"${IRRLICHT_SOURCE_DIR_LIBS}"
	/usr/local/lib
	/usr/lib
)

MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}")
MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}")

# On windows, find the dll for installation
if(WIN32)
	if(MSVC)
		FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
			PATHS
			"${IRRLICHT_SOURCE_DIR}/bin/Win32-VisualStudio"
			DOC "Path of the Irrlicht dll (for installation)"
		)
	else()
		FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
			PATHS
			"${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc"
			DOC "Path of the Irrlicht dll (for installation)"
		)
	endif()
	MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}")
endif(WIN32)

# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(IRRLICHT DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)

IF(IRRLICHT_FOUND)
  SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY})
ELSE(IRRLICHT_FOUND)
  SET(IRRLICHT_LIBRARIES)
ENDIF(IRRLICHT_FOUND)

MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL)