@@ -9,6 +9,7 @@ project(zlib C)
9
9
10
10
set (VERSION "1.3.0.1" )
11
11
12
+ option (ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON )
12
13
option (ZLIB_STATIC_LINK_CRT "Link the MSVC runtime library statically" OFF )
13
14
14
15
set (INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX} /bin" CACHE PATH "Installation directory for executables" )
@@ -211,21 +212,22 @@ endif()
211
212
#============================================================================
212
213
# Example binaries
213
214
#============================================================================
214
-
215
- add_executable (example test /example.c)
216
- target_link_libraries (example zlib)
217
- add_test (example example)
218
-
219
- add_executable (minigzip test /minigzip.c)
220
- target_link_libraries (minigzip zlib)
221
-
222
- if (HAVE_OFF64_T)
223
- add_executable (example64 test /example.c)
224
- target_link_libraries (example64 zlib)
225
- set_target_properties (example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64" )
226
- add_test (example64 example64)
227
-
228
- add_executable (minigzip64 test /minigzip.c)
229
- target_link_libraries (minigzip64 zlib)
230
- set_target_properties (minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64" )
215
+ if (ZLIB_BUILD_EXAMPLES)
216
+ add_executable (example test /example.c)
217
+ target_link_libraries (example zlib)
218
+ add_test (example example)
219
+
220
+ add_executable (minigzip test /minigzip.c)
221
+ target_link_libraries (minigzip zlib)
222
+
223
+ if (HAVE_OFF64_T)
224
+ add_executable (example64 test /example.c)
225
+ target_link_libraries (example64 zlib)
226
+ set_target_properties (example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64" )
227
+ add_test (example64 example64)
228
+
229
+ add_executable (minigzip64 test /minigzip.c)
230
+ target_link_libraries (minigzip64 zlib)
231
+ set_target_properties (minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64" )
232
+ endif ()
231
233
endif ()
0 commit comments