forked from dradtke/allegro_tiled
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
115 lines (96 loc) · 1.92 KB
/
CMakeLists.txt
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
cmake_minimum_required(VERSION 2.6)
project(allegro_tiled)
# Allows us to get CMake stuff from other places
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
#set(CMAKE_BUILD_TYPE Debug)
# Utility functions
include(Utils)
# Options
option(WANT_EXAMPLE "build the example" true)
# Use pkg-config for all deps
find_package(PkgConfig)
# Note: I've set this to not just run for APPLE
# just in case someone's using linuxbrew
add_homebrew_package_path(libxml2 zlib)
if(APPLE)
pkg_check_modules(
ALLEGRO REQUIRED
allegro-5.0
allegro_main-5.0
allegro_image-5.0
)
else()
pkg_check_modules(
ALLEGRO REQUIRED
allegro-5.0
allegro_image-5.0
)
endif()
#pkg_check_modules(
# GLIB REQUIRED
# glib-2.0
#)
pkg_check_modules(
LIBXML REQUIRED
libxml-2.0
)
pkg_check_modules(
ZLIB REQUIRED
zlib
)
link_directories(
${ALLEGRO_LIBRARY_DIRS}
${GLIB_LIBRARY_DIRS}
${LIBXML_LIBRARY_DIRS}
${ZLIB_LIBRARY_DIRS}
)
include_directories(
${ALLEGRO_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
${LIBXML_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/include
)
file(GLOB allegro_tiled_headers include/allegro5/*.h)
file(GLOB allegro_tiled_sources src/*.c)
# Generate pc files
configure_file(
misc/allegro_tiled-5.pc.in
misc/allegro_tiled-5.pc
@ONLY
)
configure_file(
misc/allegro_tiled-5.pc.in
misc/allegro_tiled-5.0.pc
@ONLY
)
# Actually build the library
add_library(
allegro_tiled
${allegro_tiled_sources}
)
# Make sure the library is linked against everything we need
target_link_libraries(
allegro_tiled
${ALLEGRO_LIBRARIES}
${GLIB_LIBRARIES}
${LIBXML_LIBRARIES}
${ZLIB_LIBRARIES}
)
install(
TARGETS allegro_tiled
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
install(
FILES ${allegro_tiled_headers}
DESTINATION include/allegro5
)
install(
FILES misc/allegro_tiled-5.pc misc/allegro_tiled-5.0.pc
DESTINATION lib/pkgconfig
)
# Build the example if the option is enabled
if (WANT_EXAMPLE)
add_subdirectory(example)
endif()