Compare commits

...

8 Commits
xy ... hunter

Author SHA1 Message Date
Tom Mason
5801940e0e bring back small undef
undef for small was removed when converting to cmake build system, which breaks compile on windows if bzlib.h is included after windows.h
2017-07-17 23:06:36 +01:00
Ruslan Baratov
641af3083a Fix CMake error with iOS toolchain 2017-03-15 19:38:09 +08:00
Ruslan Baratov
05587d1d9c Remove SHARED 2015-04-29 14:13:56 +02:00
Ruslan Baratov
dca5adbabe Set name project to BZip2 (CMake has module FindBZip2) 2015-04-29 14:12:20 +02:00
Ruslan Baratov
4eecec17ea Config-mode install 2015-04-29 14:11:12 +02:00
Ruslan Baratov
7d151fd687 Clean-up: remove trailing whitespaces 2015-04-29 13:22:20 +02:00
Ruslan Baratov
a420ebeb64 clean-up: remove commented code 2015-04-29 13:21:32 +02:00
Ruslan Baratov
aa8e19bb88 Do not modify postfix if it's already set 2015-04-29 13:20:37 +02:00
3 changed files with 68 additions and 26 deletions

View File

@ -1,6 +1,9 @@
# Copyright (c) 2015, Ruslan Baratov
# All rights reserved.
cmake_minimum_required(VERSION 3.0)
project(bzip2
project(BZip2
VERSION 1.0.6
LANGUAGES C
)
@ -52,17 +55,14 @@ set(bzip2_html
manual.html
)
set(CMAKE_DEBUG_POSTFIX "d")
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
if(MSVC)
add_definitions(-D_FILE_OFFSET_BITS=64)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
# set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL")
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
# set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
# set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
# set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
set(VER_PRODUCTNAME_STR "bzip2 - a freely available, patent free, high-quality data compressor.")
set(VER_LEGALCOPYRIGHT_STR "copyright (C) 1996-2010 Julian R Seward")
@ -84,7 +84,7 @@ if(MSVC)
)
endif(MSVC)
add_library(${local_lib_name} SHARED ${bzip2_lib_SRCS} ${bzip2_lib_HDRS} ${bzip2_DLLSRCS})
add_library(${local_lib_name} ${bzip2_lib_SRCS} ${bzip2_lib_HDRS} ${bzip2_DLLSRCS})
set_target_properties(${local_lib_name} PROPERTIES
SOVERSION ${PROJECT_VERSION}
VERSION ${PROJECT_VERSION_MAJOR}
@ -105,13 +105,6 @@ target_link_libraries(bzip2_bin bz2)
set_target_properties(bzip2_bin PROPERTIES OUTPUT_NAME bzip2)
install(TARGETS bz2 bzip2recover bzip2_bin
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include
)
file(GLOB man1 ${bzip2_SOURCE_DIR}/*.1)
@ -196,7 +189,51 @@ add_test(NAME decompress_block_size_3
endif()
# echo EXPORTS > bzip2.def
# nm bzip2.dll | grep ' T _' | sed 's/.* T _//' >> bzip2.def
# pexports bzip2.dll > bzip2.def
# lib /def:bzip2.def /machine:x86
####
# Installation (https://github.com/forexample/package-example)
set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(include_install_dir "include")
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(targets_export_name "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")
include(CMakePackageConfigHelpers)
# Note: PROJECT_VERSION is used as a VERSION
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion
)
# Note: variable 'targets_export_name' used
configure_file("cmake/Config.cmake.in" "${project_config}" @ONLY)
set(targets_to_install bz2)
if(NOT IOS)
list(APPEND targets_to_install bzip2recover bzip2_bin)
endif()
install(
TARGETS ${targets_to_install}
EXPORT "${targets_export_name}"
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin"
INCLUDES DESTINATION "${include_install_dir}"
PUBLIC_HEADER DESTINATION "${include_install_dir}"
)
install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)
install(
EXPORT "${targets_export_name}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)

View File

@ -76,6 +76,10 @@ typedef
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
# include <windows.h>
# ifdef small
/* windows.h define small to char */
# undef small
# endif
# include <io.h>
# include <sys/utime.h>
# define fdopen _fdopen

1
cmake/Config.cmake.in Normal file
View File

@ -0,0 +1 @@
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")