vcpkg/ports/bzip2/CMakeLists.txt

45 lines
1.1 KiB
CMake
Raw Normal View History

2017-01-02 08:31:42 +08:00
cmake_minimum_required(VERSION 3.0)
2017-05-11 00:18:37 +08:00
project(bzip2 C)
2017-01-02 08:31:42 +08:00
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-DBZ_DEBUG) # enable extra assertions
endif()
set(LIBBZ2_SOURCES
blocksort.c
huffman.c
crctable.c
randtable.c
compress.c
decompress.c
bzlib.c)
add_library(libbz2 ${LIBBZ2_SOURCES})
2017-05-11 06:55:18 +08:00
set_target_properties(libbz2 PROPERTIES
ARCHIVE_OUTPUT_NAME bz2 # required for FindBzip2 to work
2017-05-11 00:18:37 +08:00
DEBUG_POSTFIX d)
2017-01-02 08:31:42 +08:00
if(BUILD_SHARED_LIBS)
target_compile_definitions(libbz2 PRIVATE -DBZ_BUILD_DLL)
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
endif()
2017-01-02 08:31:42 +08:00
install(TARGETS libbz2
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
if(NOT BZIP2_SKIP_TOOLS)
add_executable(bzip2 bzip2.c ${LIBBZ2_SOURCES})
add_executable(bzip2recover bzip2recover.c ${LIBBZ2_SOURCES})
install(TARGETS bzip2 bzip2recover DESTINATION tools)
endif()
if(NOT BZIP2_SKIP_HEADERS)
install(FILES bzlib.h DESTINATION include)
endif()