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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
From 26fdb0f43b2d994de9a3d62f85fc650e8c495f18 Mon Sep 17 00:00:00 2001
From: Mikhail Paulyshka <me@mixaill.tk>
Date: Sat, 1 Apr 2017 23:16:18 +0300
Subject: [PATCH] fix cmake
---
CMakeLists.txt | 53 +++++++++++++++++++++++----------------------
src/CMakeLists.txt | 63 +++++++++++++++++++++++++++++-------------------------
2 files changed, 62 insertions(+), 54 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42934d0..796fa47 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -223,8 +223,10 @@ else (USE_EXT_GD)
add_subdirectory(src)
endif (USE_EXT_GD)
-add_subdirectory(tests)
-add_subdirectory(examples)
+if(BUILD_TEST)
+ add_subdirectory(tests)
+ add_subdirectory(examples)
+endif()
add_custom_target(distclean ${GD_SOURCE_DIR}/cmake/distclean.sh)
@@ -246,29 +248,30 @@ IF (ENABLE_LIQ AND LIQ_BUILD)
ADD_DEPENDENCIES(${GD_LIB_STATIC} libimagequant)
ENDIF(ENABLE_LIQ AND LIQ_BUILD)
-
-INSTALL(FILES docs/INSTALL DESTINATION share/docs)
-INSTALL(FILES docs/README.JPN DESTINATION share/docs)
-INSTALL(FILES docs/README.CMAKE DESTINATION share/docs)
-INSTALL(FILES docs/README.TESTING DESTINATION share/docs)
-INSTALL(FILES docs/README.TXT DESTINATION share/docs)
-
-
-INSTALL(FILES examples/arc.c DESTINATION share/docs)
-INSTALL(FILES examples/copyrotated.c DESTINATION share/docs)
-INSTALL(FILES examples/crop.c DESTINATION share/docs)
-INSTALL(FILES examples/flip.c DESTINATION share/docs)
-INSTALL(FILES examples/gif.c DESTINATION share/docs)
-INSTALL(FILES examples/nnquant.c DESTINATION share/docs)
-INSTALL(FILES examples/noIcon.pic DESTINATION share/docs)
-INSTALL(FILES examples/noIcon.sgi DESTINATION share/docs)
-INSTALL(FILES examples/noIcon.tga DESTINATION share/docs)
-INSTALL(FILES examples/noIconAlpha.tga DESTINATION share/docs)
-INSTALL(FILES examples/test_crop_threshold.png DESTINATION share/docs)
-INSTALL(FILES examples/tgaread.c DESTINATION share/docs)
-INSTALL(FILES examples/tiffread.c DESTINATION share/docs)
-INSTALL(FILES examples/windows.c DESTINATION share/docs)
-
+if(BUILD_DOCS)
+ INSTALL(FILES docs/INSTALL DESTINATION share/docs)
+ INSTALL(FILES docs/README.JPN DESTINATION share/docs)
+ INSTALL(FILES docs/README.CMAKE DESTINATION share/docs)
+ INSTALL(FILES docs/README.TESTING DESTINATION share/docs)
+ INSTALL(FILES docs/README.TXT DESTINATION share/docs)
+endif()
+
+if(BUILD_EXAMPLES)
+ INSTALL(FILES examples/arc.c DESTINATION share/docs)
+ INSTALL(FILES examples/copyrotated.c DESTINATION share/docs)
+ INSTALL(FILES examples/crop.c DESTINATION share/docs)
+ INSTALL(FILES examples/flip.c DESTINATION share/docs)
+ INSTALL(FILES examples/gif.c DESTINATION share/docs)
+ INSTALL(FILES examples/nnquant.c DESTINATION share/docs)
+ INSTALL(FILES examples/noIcon.pic DESTINATION share/docs)
+ INSTALL(FILES examples/noIcon.sgi DESTINATION share/docs)
+ INSTALL(FILES examples/noIcon.tga DESTINATION share/docs)
+ INSTALL(FILES examples/noIconAlpha.tga DESTINATION share/docs)
+ INSTALL(FILES examples/test_crop_threshold.png DESTINATION share/docs)
+ INSTALL(FILES examples/tgaread.c DESTINATION share/docs)
+ INSTALL(FILES examples/tiffread.c DESTINATION share/docs)
+ INSTALL(FILES examples/windows.c DESTINATION share/docs)
+endif()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 08fd699..497dd93 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -90,17 +90,17 @@ if (BUILD_STATIC_LIBS)
if (UNIX)
set_target_properties(${GD_LIB_STATIC} PROPERTIES OUTPUT_NAME ${GD_LIB})
endif()
-endif()
-if (WIN32 AND NOT MINGW AND NOT MSYS)
- # SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib")
- SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1)
-ENDIF(WIN32 AND NOT MINGW AND NOT MSYS)
+ if (WIN32 AND NOT MINGW AND NOT MSYS)
+ # SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib")
+ SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1)
+ ENDIF(WIN32 AND NOT MINGW AND NOT MSYS)
-if (MINGW OR MSYS)
- ADD_DEFINITIONS("-mms-bitfields")
- set_target_properties(${GD_LIB_STATIC} PROPERTIES OUTPUT_NAME ${GD_LIB})
-endif (MINGW OR MSYS)
+ if (MINGW OR MSYS)
+ ADD_DEFINITIONS("-mms-bitfields")
+ set_target_properties(${GD_LIB_STATIC} PROPERTIES OUTPUT_NAME ${GD_LIB})
+ endif (MINGW OR MSYS)
+endif()
INCLUDE_DIRECTORIES(BEFORE "${PROJECT_BINARY_DIR}" "${CMAKE_BINARY_DIR}" "${GD_SOURCE_DIR}/src")
@@ -123,32 +123,37 @@ if (BUILD_STATIC_LIBS)
target_link_libraries(${GD_LIB_STATIC} ${LIBGD_DEP_LIBS})
endif()
-set(GD_PROGRAMS gdcmpgif)
-if (PNG_FOUND)
- set(GD_PROGRAMS ${GD_PROGRAMS} gdtopng pngtogd webpng)
+if(BUILD_PROGRAMS)
+ set(GD_PROGRAMS gdcmpgif)
+
+ if (PNG_FOUND)
+ set(GD_PROGRAMS ${GD_PROGRAMS} gdtopng pngtogd webpng)
+ if (ZLIB_FOUND)
+ set(GD_PROGRAMS ${GD_PROGRAMS} gdparttopng gd2topng pngtogd2)
+ endif()
+ endif()
+
+ if (FREETYPE_FOUND)
+ set(GD_PROGRAMS ${GD_PROGRAMS} annotate)
+ endif()
+
if (ZLIB_FOUND)
- set(GD_PROGRAMS ${GD_PROGRAMS} gdparttopng gd2topng pngtogd2)
+ set(GD_PROGRAMS ${GD_PROGRAMS} gd2copypal gd2togif giftogd2)
endif()
-endif()
-if (FREETYPE_FOUND)
- set(GD_PROGRAMS ${GD_PROGRAMS} annotate)
-endif()
+ foreach(program ${GD_PROGRAMS})
+ add_executable(${program} ${program}.c)
+ if (BUILD_SHARED_LIBS)
+ target_link_libraries(${program} ${GD_LIB})
+ else()
+ target_link_libraries(${program} ${GD_LIB_STATIC})
+ endif()
+ endforeach(program)
-if (ZLIB_FOUND)
- set(GD_PROGRAMS ${GD_PROGRAMS} gd2copypal gd2togif giftogd2)
+ install(PROGRAMS bdftogd DESTINATION bin)
endif()
-foreach(program ${GD_PROGRAMS})
- add_executable(${program} ${program}.c)
- if (BUILD_SHARED_LIBS)
- target_link_libraries(${program} ${GD_LIB})
- else()
- target_link_libraries(${program} ${GD_LIB_STATIC})
- endif()
-endforeach(program)
-
set(GD_INSTALL_TARGETS ${GD_PROGRAMS})
if (BUILD_SHARED_LIBS)
set(GD_INSTALL_TARGETS ${GD_INSTALL_TARGETS} ${GD_LIB})
@@ -161,7 +166,7 @@ install(TARGETS ${GD_INSTALL_TARGETS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
-install(PROGRAMS bdftogd DESTINATION bin)
+
install(FILES
entities.h
gd.h
--
2.11.0.windows.1
|