This repository has been archived by the owner on Sep 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathCMakeLists.txt
62 lines (49 loc) · 2.04 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cmake_minimum_required(VERSION 3.1.2)
project(bzip2 C)
include(GNUInstallDirs)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
if(MSVC OR MSVC90 OR MSVC10)
set(MSVC ON)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder)
set(BZ2_LIBRARY bz2)
set(BZ2_NAMESPACE BZip2)
set(BZ2_CONFIG ${BZ2_NAMESPACE}Config)
option(BZ2_BUILD_EXE OFF)
add_library(${BZ2_LIBRARY} ${SOURCE_SUBFOLDER}/blocksort.c
${SOURCE_SUBFOLDER}/bzlib.c
${SOURCE_SUBFOLDER}/compress.c
${SOURCE_SUBFOLDER}/crctable.c
${SOURCE_SUBFOLDER}/decompress.c
${SOURCE_SUBFOLDER}/huffman.c
${SOURCE_SUBFOLDER}/randtable.c
${SOURCE_SUBFOLDER}/bzlib.h
${SOURCE_SUBFOLDER}/bzlib_private.h)
target_include_directories(${BZ2_LIBRARY} PRIVATE ${SOURCE_SUBFOLDER})
if(BZ2_BUILD_EXE)
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_SUBFOLDER}/bzip2.c)
target_link_libraries(${CMAKE_PROJECT_NAME} ${BZ2_LIBRARY})
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${SOURCE_SUBFOLDER})
endif()
set_target_properties(${BZ2_LIBRARY} PROPERTIES VERSION ${BZ2_VERSION_STRING} SOVERSION ${BZ2_VERSION_MAJOR})
export(TARGETS ${BZ2_LIBRARY}
NAMESPACE ${BZ2_NAMESPACE}::
FILE "${CMAKE_CURRENT_BINARY_DIR}/${BZ2_CONFIG}.cmake")
install(TARGETS ${BZ2_LIBRARY}
EXPORT ${BZ2_CONFIG}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
if(BZ2_BUILD_EXE)
install(TARGETS ${CMAKE_PROJECT_NAME}
EXPORT ${BZ2_CONFIG}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
install(FILES ${SOURCE_SUBFOLDER}/bzlib.h DESTINATION include)
install(EXPORT ${BZ2_CONFIG}
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}"
NAMESPACE ${BZ2_LIBRARY}::)