-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindAllegro5.cmake
84 lines (76 loc) · 2.82 KB
/
FindAllegro5.cmake
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
73
74
75
76
77
78
79
80
81
82
83
84
# - Find allegro 5
# Find the native ALLEGRO 5 includes and library
#
# ALLEGRO_INCLUDE_DIR - where to find allegro.h, etc.
# ALLEGRO_LIBRARIES - List of libraries when using allegro.
# ALLEGRO_FOUND - True if allegro found.
IF (ALLEGRO_INCLUDE_DIR)
# Already in cache, be silent
SET(ALLEGRO_FIND_QUIETLY TRUE)
ENDIF (ALLEGRO_INCLUDE_DIR)
FIND_PATH(ALLEGRO_INCLUDE_DIR allegro5
/usr/local/include
/usr/include
$ENV{MINGDIR}/include
${CMAKE_SOURCE_DIR}/allegro/include
)
set(VERSION_NUMBER "5.1")
if(UNIX AND NOT CYGWIN)
exec_program(pkg-config ARGS "allegro-${VERSION_NUMBER} allegro_ttf-${VERSION_NUMBER} allegro_font-${VERSION_NUMBER} allegro_dialog-${VERSION_NUMBER} --libs" OUTPUT_VARIABLE ALLEGRO_LIBRARIES)
IF (NOT ${ALLEGRO_LIBRARIES})
# FALL BACK TO 5.0
set(VERSION_NUMBER "5.0")
exec_program(pkg-config ARGS "allegro-${VERSION_NUMBER} allegro_ttf-${VERSION_NUMBER} allegro_font-${VERSION_NUMBER} allegro_dialog-${VERSION_NUMBER} --libs" OUTPUT_VARIABLE ALLEGRO_LIBRARIES)
ENDIF (NOT ${ALLEGRO_LIBRARIES})
# Check if any of these checks have found if so then cause failure)
STRING(REGEX MATCH "not found" LIB_CHECK ${ALLEGRO_LIBRARIES})
IF (${LIB_CHECK})
set(ALLEGRO_LIBRARIES "")
ENDIF (${LIB_CHECK})
else(UNIX AND NOT CYGWIN)
FIND_LIBRARY(ALLEGRO_LIBRARY
NAMES allegro-5.0.0-monolith-mt
allegro-5.0.1-monolith-mt
allegro-5.0.2-monolith-mt
allegro-5.0.3-monolith-mt
allegro-5.0.4-monolith-mt
allegro-5.0.5-monolith-mt
allegro-5.0.6-monolith-mt
allegro-5.0.7-monolith-mt
allegro-5.0.8-monolith-mt
allegro-5.0.9-monolith-mt
allegro-5.0.10-monolith-mt
allegro-5.0.11-monolith-mt
allegro-5.0.12-monolith-mt
allegro-5.0.13-monolith-mt
allegro-5.0.14-monolith-mt
allegro-5.0.15-monolith-mt
allegro-5.1.0-monolith-mt
PATHS /usr/lib /usr/local/lib $ENV{MINGDIR}/lib ${CMAKE_SOURCE_DIR}/allegro/lib)
set(ALLEGRO_W ${ALLEGRO_LIBRARY})
endif(UNIX AND NOT CYGWIN)
IF (ALLEGRO_INCLUDE_DIR AND (ALLEGRO_LIBRARIES OR ALLEGRO_LIBRARY))
SET(ALLEGRO_FOUND TRUE)
SET( ALLEGRO_LIBRARIES ${ALLEGRO_LIBRARIES} )
IF (ALLEGRO_LIBRARY)
add_definitions(-DALLEGRO_STATICLINK)
set(ALLEGRO_LIBRARIES ${ALLEGRO_LIBRARY})
ENDIF(ALLEGRO_LIBRARY)
ELSE (ALLEGRO_INCLUDE_DIR AND (ALLEGRO_LIBRARIES OR ALLEGRO_LIBRARY))
SET(ALLEGRO_FOUND FALSE)
SET( ALLEGRO_LIBRARIES )
ENDIF (ALLEGRO_INCLUDE_DIR AND (ALLEGRO_LIBRARIES OR ALLEGRO_LIBRARY))
IF (ALLEGRO_FOUND)
IF (NOT ALLEGRO_FIND_QUIETLY)
MESSAGE(STATUS "Found Allegro 5: ${ALLEGRO_LIBRARIES}")
ENDIF (NOT ALLEGRO_FIND_QUIETLY)
ELSE (ALLEGRO_FOUND)
IF (ALLEGRO_FIND_REQUIRED)
MESSAGE(STATUS "Looked for Allegro 5 libraries named ${ALLEGRO_NAMES}.")
MESSAGE(FATAL_ERROR "Could NOT find Allegro 5 library")
ENDIF (ALLEGRO_FIND_REQUIRED)
ENDIF (ALLEGRO_FOUND)
MARK_AS_ADVANCED(
ALLEGRO_LIBRARIES
ALLEGRO_INCLUDE_DIR
)