|
1
|
cmake_minimum_required(VERSION 3.12...3.31) |
|
2
|
|
|
3
|
project( |
|
4
|
testzlib |
|
5
|
VERSION 1.0.0 |
|
6
|
LANGUAGES C |
|
7
|
DESCRIPTION "A little program to test zlib" |
|
8
|
HOMEPAGE_URL "https://www.zlib.net") |
|
9
|
|
|
10
|
option(ZLIB_TESTZLIB_BUILD_SHARED "Enable building testzlib" ON) |
|
11
|
option(ZLIB_TESTZLIB_BUILD_STATIC "Enable building static linked testzlib" ON) |
|
12
|
option(ZLIB_TESTZLIB_INSTALL "Enable installation of testzlib" ON) |
|
13
|
|
|
14
|
if(ZLIB_TESTZLIB_BUILD_SHARED) |
|
15
|
add_executable(zlib_testzlib testzlib.c) |
|
16
|
target_link_libraries(zlib_testzlib PRIVATE ZLIB::ZLIB) |
|
17
|
|
|
18
|
set_target_properties(zlib_testzlib |
|
19
|
PROPERTIES |
|
20
|
OUTPUT_NAME testzlib) |
|
21
|
|
|
22
|
if(ZLIB_TESTZLIB_INSTALL) |
|
23
|
install( |
|
24
|
TARGETS zlib_testzlib |
|
25
|
COMPONENT Runtime |
|
26
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") |
|
27
|
endif(ZLIB_TESTZLIB_INSTALL) |
|
28
|
endif(ZLIB_TESTZLIB_BUILD_SHARED) |
|
29
|
|
|
30
|
if(ZLIB_TESTZLIB_BUILD_STATIC) |
|
31
|
add_executable(zlib_testzlibStatic testzlib.c) |
|
32
|
target_link_libraries(zlib_testzlibStatic PRIVATE ZLIB::ZLIBSTATIC) |
|
33
|
|
|
34
|
set_target_properties(zlib_testzlibStatic |
|
35
|
PROPERTIES |
|
36
|
OUTPUT_NAME testzlibStatic) |
|
37
|
|
|
38
|
if(ZLIB_TESTZLIB_INSTALL) |
|
39
|
install( |
|
40
|
TARGETS zlib_testzlibStatic |
|
41
|
COMPONENT Runtime |
|
42
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") |
|
43
|
endif(ZLIB_TESTZLIB_INSTALL) |
|
44
|
endif(ZLIB_TESTZLIB_BUILD_STATIC) |
|
45
|
|