forked from ladislav-zezula/CascLib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
119 lines (103 loc) · 3.34 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
cmake_minimum_required(VERSION 2.6)
project(CascLib)
set(HEADER_FILES
src/CascCommon.h
src/CascLib.h
src/CascMndxRoot.h
src/CascPort.h
src/common/Common.h
src/common/FileStream.h
src/common/ListFile.h
src/jenkins/lookup.h
)
set(SRC_FILES
src/common/Common.cpp
src/common/Directory.cpp
src/common/FileStream.cpp
src/common/ListFile.cpp
src/jenkins/lookup3.c
src/CascBuildCfg.cpp
src/CascCommon.cpp
src/CascDecompress.cpp
src/CascDumpData.cpp
src/CascFindFile.cpp
src/CascMndxRoot.cpp
src/CascOpenFile.cpp
src/CascOpenStorage.cpp
src/CascReadFile.cpp
)
set(TOMCRYPT_FILES
src/libtomcrypt/src/hashes/hash_memory.c
src/libtomcrypt/src/hashes/md5.c
src/libtomcrypt/src/misc/crypt_argchk.c
src/libtomcrypt/src/misc/crypt_hash_descriptor.c
src/libtomcrypt/src/misc/crypt_hash_is_valid.c
src/libtomcrypt/src/misc/crypt_libc.c
)
set(ZLIB_BZIP2_FILES
src/zlib/adler32.c
src/zlib/crc32.c
src/zlib/inffast.c
src/zlib/inflate.c
src/zlib/inftrees.c
src/zlib/trees.c
src/zlib/zutil.c
)
set(TEST_SRC_FILES
test/CascTest.cpp
)
add_definitions(-D_7ZIP_ST -DBZ_STRICT_ANSI)
if(WIN32)
if(MSVC)
message(STATUS "Using MSVC")
add_definitions(-D_7ZIP_ST -DWIN32)
else()
message(STATUS "Using mingw")
endif()
set(SRC_ADDITIONAL_FILES ${ZLIB_BZIP2_FILES} ${TOMCRYPT_FILES})
set(LINK_LIBS wininet)
endif()
if(APPLE)
message(STATUS "Using Mac OS X port")
set(LINK_LIBS z bz2)
set(SRC_ADDITIONAL_FILES ${TOMCRYPT_FILES})
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
message(STATUS "Using Linux port")
option(WITH_LIBTOMCRYPT "Use system LibTomCrypt library" OFF)
if(WITH_LIBTOMCRYPT)
set(LINK_LIBS z bz2 tomcrypt)
else()
set(LINK_LIBS z bz2)
set(SRC_ADDITIONAL_FILES ${TOMCRYPT_FILES})
endif()
endif()
add_library(casc SHARED ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(casc ${LINK_LIBS})
option(WITH_TEST "Compile Test application" OFF)
if(WITH_TEST)
add_executable(casc_test ${TEST_SRC_FILES})
target_link_libraries(casc_test casc)
endif()
option(WITH_STATIC "Compile static linked library" OFF)
if(WITH_STATIC)
add_library(casc_static STATIC ${SRC_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(casc_static ${LINK_LIBS})
set_target_properties(casc_static PROPERTIES OUTPUT_NAME casc)
install(TARGETS casc_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib FRAMEWORK DESTINATION /Library/Frameworks)
endif()
if(APPLE)
set_target_properties(casc PROPERTIES FRAMEWORK true)
set_target_properties(casc PROPERTIES PUBLIC_HEADER "src/CascLib.h src/CascPort.h")
set_target_properties(casc PROPERTIES LINK_FLAGS "-framework Carbon")
endif()
if(UNIX)
set_target_properties(casc PROPERTIES VERSION 1.0.0)
set_target_properties(casc PROPERTIES SOVERSION 1)
endif()
# On Win32, build CascLib.dll
if(WIN32)
set_target_properties(casc PROPERTIES OUTPUT_NAME CascLib)
endif()
install(TARGETS casc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib FRAMEWORK DESTINATION /Library/Frameworks)
install(FILES src/CascLib.h src/CascPort.h DESTINATION include)