0
0
mirror of https://github.com/madler/zlib.git synced 2026-01-18 17:11:27 +01:00

CMake: Add install-target for contrib/testzlib.

This commit is contained in:
Vollstrecker
2026-01-04 14:26:33 +01:00
committed by Mark Adler
parent e62a3ddbe3
commit edd88953de

View File

@@ -9,14 +9,36 @@ project(
option(ZLIB_TESTZLIB_BUILD_SHARED "Enable building testzlib" ON)
option(ZLIB_TESTZLIB_BUILD_STATIC "Enable building static linked testzlib" ON)
option(ZLIB_TESTZLIB_BUILD_TESTING "Enable building tests for testzlib" ON)
option(ZLIB_TESTZLIB_INSTALL "Enable installation of testzlib" ON)
if(ZLIB_TESTZLIB_BUILD_SHARED)
add_executable(testzlib testzlib.c)
target_link_libraries(testzlib PRIVATE ZLIB::ZLIB)
add_executable(zlib_testzlib testzlib.c)
target_link_libraries(zlib_testzlib PRIVATE ZLIB::ZLIB)
set_target_properties(zlib_testzlib
PROPERTIES
OUTPUT_NAME testzlib)
if(ZLIB_TESTZLIB_INSTALL)
install(
TARGETS zlib_testzlib
COMPONENT Runtime
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif(ZLIB_TESTZLIB_INSTALL)
endif(ZLIB_TESTZLIB_BUILD_SHARED)
if(ZLIB_TESTZLIB_BUILD_STATIC)
add_executable(testzlibStatic testzlib.c)
target_link_libraries(testzlibStatic PRIVATE ZLIB::ZLIBSTATIC)
add_executable(zlib_testzlibStatic testzlib.c)
target_link_libraries(zlib_testzlibStatic PRIVATE ZLIB::ZLIBSTATIC)
set_target_properties(zlib_testzlibStatic
PROPERTIES
OUTPUT_NAME testzlibStatic)
if(ZLIB_TESTZLIB_INSTALL)
install(
TARGETS zlib_testzlibStatic
COMPONENT Runtime
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif(ZLIB_TESTZLIB_INSTALL)
endif(ZLIB_TESTZLIB_BUILD_STATIC)