diff options
author | Peter Taylor <emersont1@outlook.com> | 2017-02-10 18:37:09 +0000 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2024-01-17 15:34:01 -0800 |
commit | 6201f893846bfd22faf060e84a3bb7bfc0e61761 (patch) | |
tree | 8a93b2e2ebc8812082ddbdfdc50493b3a17102d2 | |
parent | 14a5f8f266c16c87ab6c086fc52b770b27701e01 (diff) | |
download | zlib-6201f893846bfd22faf060e84a3bb7bfc0e61761.tar.gz zlib-6201f893846bfd22faf060e84a3bb7bfc0e61761.tar.bz2 zlib-6201f893846bfd22faf060e84a3bb7bfc0e61761.zip |
Add cmake option to control the build of the example executables.
-rw-r--r-- | CMakeLists.txt | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 157097e..61188e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -9,6 +9,7 @@ project(zlib C) | |||
9 | 9 | ||
10 | set(VERSION "1.3.0.1") | 10 | set(VERSION "1.3.0.1") |
11 | 11 | ||
12 | option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON) | ||
12 | option(ZLIB_STATIC_LINK_CRT "Link the MSVC runtime library statically" OFF) | 13 | option(ZLIB_STATIC_LINK_CRT "Link the MSVC runtime library statically" OFF) |
13 | 14 | ||
14 | set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") | 15 | set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") |
@@ -211,21 +212,22 @@ endif() | |||
211 | #============================================================================ | 212 | #============================================================================ |
212 | # Example binaries | 213 | # Example binaries |
213 | #============================================================================ | 214 | #============================================================================ |
214 | 215 | if(ZLIB_BUILD_EXAMPLES) | |
215 | add_executable(example test/example.c) | 216 | add_executable(example test/example.c) |
216 | target_link_libraries(example zlib) | 217 | target_link_libraries(example zlib) |
217 | add_test(example example) | 218 | add_test(example example) |
218 | 219 | ||
219 | add_executable(minigzip test/minigzip.c) | 220 | add_executable(minigzip test/minigzip.c) |
220 | target_link_libraries(minigzip zlib) | 221 | target_link_libraries(minigzip zlib) |
221 | 222 | ||
222 | if(HAVE_OFF64_T) | 223 | if(HAVE_OFF64_T) |
223 | add_executable(example64 test/example.c) | 224 | add_executable(example64 test/example.c) |
224 | target_link_libraries(example64 zlib) | 225 | target_link_libraries(example64 zlib) |
225 | set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") | 226 | set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") |
226 | add_test(example64 example64) | 227 | add_test(example64 example64) |
227 | 228 | ||
228 | add_executable(minigzip64 test/minigzip.c) | 229 | add_executable(minigzip64 test/minigzip.c) |
229 | target_link_libraries(minigzip64 zlib) | 230 | target_link_libraries(minigzip64 zlib) |
230 | set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") | 231 | set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") |
232 | endif() | ||
231 | endif() | 233 | endif() |