]>
Commit | Line | Data |
---|---|---|
8b7ba998 TK |
1 | # |
2 | # | |
3 | PROJECT(libarchive) | |
4 | # | |
5 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6.1) | |
3133e6d6 | 6 | SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") |
8b7ba998 TK |
7 | # |
8 | # Version - read from 'version' file. | |
9 | # | |
3133e6d6 | 10 | FILE(STRINGS ${CMAKE_SOURCE_DIR}/version _version) |
8b7ba998 | 11 | STRING(REGEX REPLACE |
97b032b7 | 12 | "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]?$" "\\1" _major ${_version}) |
8b7ba998 | 13 | STRING(REGEX REPLACE |
97b032b7 | 14 | "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]?$" "\\1" _minor ${_version}) |
8b7ba998 | 15 | STRING(REGEX REPLACE |
97b032b7 | 16 | "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]?$" "\\1" _revision ${_version}) |
8b7ba998 | 17 | STRING(REGEX REPLACE |
97b032b7 | 18 | "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]?)$" "\\1" _quality ${_version}) |
8b7ba998 TK |
19 | SET(_version_number ${_major}${_minor}${_revision}) |
20 | STRING(REGEX REPLACE ".*([^0][0-9]*)$" "\\1" _minor ${_minor}) | |
21 | STRING(REGEX REPLACE ".*([^0][0-9]*)$" "\\1" _revision ${_revision}) | |
22 | # | |
8b7ba998 | 23 | SET(VERSION "${_major}.${_minor}.${_revision}${_quality}") |
806025f2 | 24 | SET(BSDCPIO_VERSION_STRING "${VERSION}") |
8b7ba998 TK |
25 | SET(BSDTAR_VERSION_STRING "${VERSION}") |
26 | SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}") | |
27 | SET(LIBARCHIVE_VERSION_STRING "${VERSION}") | |
806025f2 TK |
28 | |
29 | OPTION(ENABLE_TAR "Enable tar building" ON) | |
30 | OPTION(ENABLE_CPIO "Enable cpio building" ON) | |
31 | OPTION(ENABLE_XATTR "Enable extended attribute support" ON) | |
32 | OPTION(ENABLE_ACL "Enable ACL support" ON) | |
33 | OPTION(ENABLE_TEST "Enable unit and regression tests" ON) | |
34 | ||
35 | IF(ENABLE_TEST) | |
36 | ENABLE_TESTING() | |
37 | ENDIF(ENABLE_TEST) | |
38 | ||
8b7ba998 | 39 | # |
62f47df1 | 40 | # On Windows, currently, bsdtar and bsdcpio are not supported. |
8b7ba998 | 41 | # |
62f47df1 | 42 | IF (WIN32) |
806025f2 TK |
43 | SET(ENABLE_TAR 0) |
44 | SET(ENABLE_CPIO 0) | |
62f47df1 | 45 | ENDIF (WIN32) |
8b7ba998 TK |
46 | # |
47 | INCLUDE(CheckLibraryExists) | |
48 | INCLUDE(CheckFuncs) | |
49 | INCLUDE(CheckHeaders) | |
50 | INCLUDE(CheckHeaderDirent) | |
51 | INCLUDE(CheckHeaderSTDC) | |
52 | INCLUDE(CheckIncludeFile) | |
53 | INCLUDE(CheckStructMember) | |
54 | INCLUDE(CheckSymbolExists) | |
55 | INCLUDE(CheckTypeExists) | |
56 | INCLUDE(CheckTypeSize) | |
87b05751 | 57 | |
8b7ba998 TK |
58 | # |
59 | # For yacc file, generate *.c from *.y | |
60 | # | |
61 | MACRO (YACC_FILE _yaccfile) | |
62 | FIND_PROGRAM(YACC NAMES yacc bison) | |
63 | IF ("YACC" MATCHES "^YACC-NOTFOUND$") | |
64 | MESSAGE(FATAL_ERROR "You need a parser geerator such as yacc.") | |
65 | ENDIF ("YACC" MATCHES "^YACC-NOTFOUND$") | |
66 | GET_FILENAME_COMPONENT(_path ${_yaccfile} PATH) | |
67 | GET_FILENAME_COMPONENT(_name ${_yaccfile} NAME_WE) | |
68 | SET(_basename "${_path}/${_name}") | |
3133e6d6 | 69 | FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_path}") |
8b7ba998 | 70 | ADD_CUSTOM_COMMAND( |
3133e6d6 TK |
71 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.c ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h |
72 | COMMAND ${YACC} -o ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.c ${CMAKE_CURRENT_SOURCE_DIR}/${_yaccfile} | |
73 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_yaccfile} | |
8b7ba998 TK |
74 | COMMENT "Generating ${_basename}.c from ${_yaccfile}" |
75 | ) | |
76 | ENDMACRO (YACC_FILE) | |
77 | # | |
78 | # Generate list.h | |
79 | # | |
36076745 | 80 | MACRO (GENERATE_LIST_H _listfile __list_sources) |
8b7ba998 TK |
81 | IF (NOT EXISTS "${_listfile}" OR |
82 | ${CMAKE_CURRENT_LIST_FILE} IS_NEWER_THAN "${_listfile}") | |
83 | ||
84 | MESSAGE(STATUS "Generating ${_listfile}") | |
85 | FILE(WRITE ${_listfile} "") | |
86 | FOREACH (testfile ${ARGV}) | |
87 | IF (testfile MATCHES ".+/test_[^/]+[.]c$") | |
88 | FILE(STRINGS ${testfile} testvar REGEX "^DEFINE_TEST") | |
89 | FOREACH (deftest ${testvar}) | |
90 | FILE(APPEND ${_listfile} "${deftest}\n") | |
91 | ENDFOREACH (deftest) | |
92 | ENDIF (testfile MATCHES ".+/test_[^/]+[.]c$") | |
93 | ENDFOREACH (testfile) | |
94 | ||
95 | ENDIF (NOT EXISTS "${_listfile}" OR | |
96 | ${CMAKE_CURRENT_LIST_FILE} IS_NEWER_THAN "${_listfile}") | |
97 | ENDMACRO (GENERATE_LIST_H) | |
98 | ||
99 | # | |
100 | # Check compress/decompress libraries | |
101 | # | |
102 | IF(WIN32) | |
be4c3c3c MN |
103 | # You need to add a path availabel DLL file into PATH environment variable. |
104 | # Maybe DLL path is "C:/Program Files/GnuWin32/bin". | |
105 | # The zlib and the bzip2 Setup program install programs and DLLs into | |
106 | # "C:/Program Files/GnuWin32" which is default. | |
107 | # If you do not use Setup program or install into different path, You change | |
108 | # path from "C:/Program Files/GnuWin32" to where you installed the one. | |
109 | SET(GNUWIN32PATH "C:/Program Files/GnuWin32") | |
110 | # After add DLL path, You still need 'lib' directory to detecte libraries | |
111 | # by cmake. | |
112 | SET(CMAKE_PREFIX_PATH "${GNUWIN32PATH}/lib" $(CMAKE_PREFIX_PATH)) | |
113 | # If compiling error occured in zconf.h, maybe you need patch to zconf.h. | |
114 | #--- zconf.h.orig 2005-07-21 00:40:26.000000000 +0900 | |
115 | #+++ zconf.h 2009-01-19 11:39:10.093750000 +0900 | |
116 | #@@ -286,7 +286,7 @@ | |
117 | # | |
118 | # #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */ | |
119 | # # include <sys/types.h> /* for off_t */ | |
120 | #-# include <unistd.h> /* for SEEK_* and off_t */ | |
121 | #+# include <stdio.h> /* for SEEK_* and off_t */ | |
122 | # # ifdef VMS | |
123 | # # include <unixio.h> /* for off_t */ | |
124 | # # endif | |
125 | SET(ZLIB_INCLUDE_DIR "${GNUWIN32PATH}/include") | |
126 | SET(BZIP2_INCLUDE_DIR "${GNUWIN32PATH}/include") | |
8b7ba998 TK |
127 | ENDIF(WIN32) |
128 | ||
129 | SET(ADDITIONAL_LIBS "") | |
130 | # | |
131 | # Find ZLIB | |
132 | # | |
133 | FIND_PACKAGE(ZLIB) | |
134 | IF(ZLIB_FOUND) | |
135 | SET(HAVE_LIBZ 1) | |
136 | SET(HAVE_ZLIB_H 1) | |
137 | INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) | |
138 | LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) | |
139 | ENDIF(ZLIB_FOUND) | |
140 | # | |
141 | # Find BZip2 | |
142 | # | |
143 | FIND_PACKAGE(BZip2) | |
144 | IF(BZIP2_FOUND) | |
145 | SET(HAVE_LIBBZ2 1) | |
146 | SET(HAVE_BZLIB_H 1) | |
147 | INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) | |
148 | LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) | |
149 | ENDIF(BZIP2_FOUND) | |
150 | # | |
151 | # Find LZMA | |
152 | # | |
153 | FIND_PACKAGE(LZMA) | |
154 | IF(LZMA_FOUND) | |
155 | SET(HAVE_LIBLZMADEC 1) | |
156 | SET(HAVE_LZMADEC_H 1) | |
157 | INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR}) | |
158 | LIST(APPEND ADDITIONAL_LIBS ${LZMA_LIBRARIES}) | |
159 | ENDIF(LZMA_FOUND) | |
160 | ||
161 | # | |
162 | # Check headers | |
163 | # | |
164 | CHECK_HEADER_STDC() | |
165 | CHECK_HEADER_DIRENT() | |
166 | # TODO : AC_HEADER_SYS_WAIT | |
167 | CHECK_INCLUDE_FILE(sys/wait.h HAVE_SYS_WAIT_H) | |
168 | ||
6943997e | 169 | CHECK_HEADERS(ctype.h errno.h ext2fs/ext2_fs.h fcntl.h grp.h) |
8b7ba998 TK |
170 | CHECK_HEADERS(inttypes.h langinfo.h limits.h linux/fs.h) |
171 | CHECK_HEADERS(locale.h paths.h poll.h pwd.h regex.h stdarg.h) | |
172 | CHECK_HEADERS(stdint.h stdlib.h string.h) | |
173 | CHECK_HEADERS(sys/acl.h sys/extattr.h sys/ioctl.h) | |
174 | CHECK_HEADERS(sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h) | |
9a140f08 | 175 | CHECK_HEADERS(time.h unistd.h utime.h wchar.h wctype.h windows.h) |
8b7ba998 TK |
176 | |
177 | CHECK_INCLUDE_FILE(direct.h HAVE_DIRECT_H) | |
178 | CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H) | |
179 | CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H) | |
180 | CHECK_INCLUDE_FILE(process.h HAVE_PROCESS_H) | |
181 | CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H) | |
182 | CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H) | |
183 | CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H) | |
184 | ||
22b1a517 | 185 | # |
380345e6 | 186 | # Check MD5/RMD160/SHA headers |
22b1a517 | 187 | # |
380345e6 | 188 | CHECK_HEADERS(openssl/md5.h openssl/ripemd.h openssl/sha.h) |
22b1a517 MN |
189 | SET(_files "") |
190 | IF(HAVE_SYS_TYPES_H) | |
191 | SET(_files "sys/types.h") | |
192 | ENDIF(HAVE_SYS_TYPES_H) | |
193 | CHECK_INCLUDE_FILE(md5global.h HAVE_MD5GLOBAL_H) | |
194 | IF(HAVE_MD5GLOBAL_H) | |
195 | SET(_files ${_files} "md5global.h") | |
196 | ENDIF(HAVE_MD5GLOBAL_H) | |
197 | SET(_files ${_files} "md5.h") | |
198 | CHECK_INCLUDE_FILES("${_files}" HAVE_MD5_H) | |
380345e6 | 199 | CHECK_HEADERS(ripemd.h rmd160.h) |
2846d884 | 200 | CHECK_HEADERS(sha.h sha1.h sha2.h sha256.h) |
16151528 | 201 | # |
380345e6 | 202 | # Find MD5/RMD160/SHA library |
16151528 | 203 | # |
2846d884 MN |
204 | FIND_LIBRARY(CRYPTO_LIBRARY NAMES crypto) |
205 | IF(CRYPTO_LIBRARY) | |
206 | LIST(APPEND ADDITIONAL_LIBS ${CRYPTO_LIBRARY}) | |
207 | ELSE(CRYPTO_LIBRARY) | |
208 | FIND_LIBRARY(SSL_LIBRARY NAMES ssl) | |
209 | IF(SSL_LIBRARY) | |
210 | LIST(APPEND ADDITIONAL_LIBS ${SSL_LIBRARY}) | |
211 | ELSE(SSL_LIBRARY) | |
212 | FIND_LIBRARY(MD_LIBRARY NAMES md) | |
213 | IF(MD_LIBRARY) | |
214 | LIST(APPEND ADDITIONAL_LIBS ${MD_LIBRARY}) | |
215 | ENDIF(MD_LIBRARY) | |
216 | ENDIF(SSL_LIBRARY) | |
217 | ENDIF(CRYPTO_LIBRARY) | |
218 | # | |
380345e6 | 219 | # Check MD5/RMD160/SHA functions |
2846d884 MN |
220 | # |
221 | SET(CMAKE_REQUIRED_LIBRARIES ${ADDITIONAL_LIBS}) | |
222 | CHECK_FUNCTION_EXISTS(MD5_Init HAVE_MD5_Init) | |
223 | IF(NOT HAVE_MD5_Init) | |
224 | CHECK_FUNCTION_EXISTS(MD5Init HAVE_MD5Init) | |
225 | IF(HAVE_MD5Init) | |
226 | SET(MD5_Init, "MD5Init") | |
227 | SET(MD5_Update, "MD5Update") | |
228 | SET(MD5_Final, "MD5Final") | |
229 | ENDIF(HAVE_MD5Init) | |
230 | ENDIF(NOT HAVE_MD5_Init) | |
231 | IF(HAVE_MD5_Init OR HAVE_MD5Init) | |
232 | SET(HAVE_MD5 1) | |
233 | ENDIF(HAVE_MD5_Init OR HAVE_MD5Init) | |
234 | # | |
380345e6 MN |
235 | CHECK_FUNCTION_EXISTS(RIPEMD160_Init HAVE_RIPEMD160_Init) |
236 | IF(NOT HAVE_RIPEMD160_Init) | |
237 | CHECK_FUNCTION_EXISTS(RMD160Init HAVE_RMD160Init) | |
238 | IF(HAVE_RMD160Init) | |
239 | SET(RIPEMD160_Init, "RMD160Init") | |
240 | SET(RIPEMD160_Update, "RMD160Update") | |
241 | SET(RIPEMD160_Final, "RMD160Final") | |
242 | ENDIF(HAVE_RMD160Init) | |
243 | ENDIF(NOT HAVE_RIPEMD160_Init) | |
244 | IF(HAVE_RIPEMD160_Init OR HAVE_RMD160Init) | |
245 | SET(HAVE_RMD160 1) | |
246 | ENDIF(HAVE_RIPEMD160_Init OR HAVE_RMD160Init) | |
247 | # | |
2846d884 MN |
248 | CHECK_FUNCTION_EXISTS(SHA1_Init HAVE_SHA1_Init) |
249 | IF(NOT HAVE_SHA1_Init) | |
250 | CHECK_FUNCTION_EXISTS(SHA1Init HAVE_SHA1Init) | |
251 | IF(HAVE_SHA1Init) | |
252 | SET(SHA1_Init, "SHA1Init") | |
253 | SET(SHA1_Update, "SHA1Update") | |
254 | SET(SHA1_Final, "SHA1Final") | |
255 | ENDIF(HAVE_SHA1Init) | |
256 | ENDIF(NOT HAVE_SHA1_Init) | |
257 | IF(HAVE_SHA1_Init OR HAVE_SHA1Init) | |
258 | SET(HAVE_SHA1 1) | |
259 | ENDIF(HAVE_SHA1_Init OR HAVE_SHA1Init) | |
260 | # | |
261 | CHECK_FUNCTION_EXISTS(SHA256_Init HAVE_SHA256) | |
262 | CHECK_FUNCTION_EXISTS(SHA384_Init HAVE_SHA384) | |
263 | CHECK_FUNCTION_EXISTS(SHA512_Init HAVE_SHA512) | |
22b1a517 | 264 | |
8b7ba998 TK |
265 | # |
266 | # Check functions | |
267 | # | |
9a140f08 TK |
268 | CHECK_FUNCS(chflags chown chroot) |
269 | CHECK_FUNCS(extattr_get_file extattr_list_file) | |
270 | CHECK_FUNCS(extattr_set_fd extattr_set_file) | |
8b7ba998 TK |
271 | CHECK_FUNCS(fchdir fchflags fchmod fchown fcntl fork) |
272 | CHECK_FUNCS(fstat ftruncate futimes geteuid getpid) | |
273 | CHECK_FUNCS(lchflags lchmod lchown) | |
274 | CHECK_FUNCS(lutimes memmove memset mkdir mkfifo mknod) | |
9a140f08 | 275 | CHECK_FUNCS(nl_langinfo pipe poll readlink select setenv setlocale) |
8b7ba998 TK |
276 | CHECK_FUNCS(strchr strdup strerror strrchr timegm) |
277 | CHECK_FUNCS(tzset unsetenv utime utimes vfork) | |
278 | CHECK_FUNCS(wcscpy wcslen wctomb wmemcmp wmemcpy) | |
279 | ||
280 | ||
281 | SET(CMAKE_REQUIRED_LIBRARIES "") | |
282 | CHECK_SYMBOL_EXISTS(fnmatch "fnmatch.h" HAVE_FNMATCH) | |
283 | CHECK_SYMBOL_EXISTS(fseeko "stdio.h" HAVE_FSEEKO) | |
284 | CHECK_SYMBOL_EXISTS(strerror_r "string.h" HAVE_STRERROR_R) | |
285 | CHECK_SYMBOL_EXISTS(strftime "time.h" HAVE_STRFTIME) | |
286 | CHECK_SYMBOL_EXISTS(vprintf "stdio.h" HAVE_VPRINTF) | |
287 | ||
288 | IF(HAVE_STRERROR_R) | |
289 | SET(HAVE_DECL_STRERROR_R 1) | |
290 | ENDIF(HAVE_STRERROR_R) | |
291 | ||
292 | # | |
293 | # Check defines | |
294 | # | |
295 | CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE) | |
296 | CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ) | |
297 | CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER) | |
298 | CHECK_SYMBOL_EXISTS(FNM_LEADING_DIR "fnmatch.h" HAVE_FNM_LEADING_DIR) | |
299 | CHECK_SYMBOL_EXISTS(optarg "unistd.h" HAVE_DECL_OPTARG) | |
300 | CHECK_SYMBOL_EXISTS(optind "unistd.h" HAVE_DECL_OPTIND) | |
301 | IF(HAVE_STDINT_H) | |
302 | CHECK_SYMBOL_EXISTS(INT64_MAX "stdint.h" HAVE_DECL_INT64_MAX) | |
303 | CHECK_SYMBOL_EXISTS(INT64_MIN "stdint.h" HAVE_DECL_INT64_MIN) | |
304 | CHECK_SYMBOL_EXISTS(UINT32_MAX "stdint.h" HAVE_DECL_UINT32_MAX) | |
305 | CHECK_SYMBOL_EXISTS(UINT64_MAX "stdint.h" HAVE_DECL_UINT64_MAX) | |
306 | CHECK_SYMBOL_EXISTS(SIZE_MAX "stdint.h" HAVE_DECL_SIZE_MAX) | |
307 | ELSE(HAVE_STDINT_H) | |
308 | CHECK_SYMBOL_EXISTS(INT64_MAX "limits.h" HAVE_DECL_INT64_MAX) | |
309 | CHECK_SYMBOL_EXISTS(INT64_MIN "limits.h" HAVE_DECL_INT64_MIN) | |
310 | CHECK_SYMBOL_EXISTS(UINT32_MAX "limits.h" HAVE_DECL_UINT32_MAX) | |
311 | CHECK_SYMBOL_EXISTS(UINT64_MAX "limits.h" HAVE_DECL_UINT64_MAX) | |
312 | CHECK_SYMBOL_EXISTS(SIZE_MAX "limits.h" HAVE_DECL_SIZE_MAX) | |
313 | ENDIF(HAVE_STDINT_H) | |
314 | CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) | |
315 | ||
316 | # | |
317 | # Check struct members | |
318 | # | |
319 | # Check for birthtime in struct stat | |
320 | CHECK_STRUCT_MEMBER("struct stat" st_birthtime | |
321 | "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIME) | |
322 | ||
323 | # Check for high-resolution timestamps in struct stat | |
324 | CHECK_STRUCT_MEMBER("struct stat" st_birthtimespec.tv_nsec | |
325 | "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) | |
326 | CHECK_STRUCT_MEMBER("struct stat" st_mtimespec.tv_nsec | |
327 | "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) | |
328 | CHECK_STRUCT_MEMBER("struct stat" st_mtim.tv_nsec | |
329 | "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) | |
330 | # Check for block size support in struct stat | |
331 | CHECK_STRUCT_MEMBER("struct stat" st_blksize | |
332 | "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE) | |
333 | # Check for st_flags in struct stat (BSD fflags) | |
334 | CHECK_STRUCT_MEMBER("struct stat" st_flags | |
335 | "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS) | |
336 | # | |
337 | # | |
338 | CHECK_STRUCT_MEMBER("struct tm" tm_sec | |
339 | "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME) | |
340 | ||
341 | # | |
87b05751 TK |
342 | # Check for integer types |
343 | # | |
344 | # XXX There must be a way to make this simpler <sigh> XXXX | |
8b7ba998 TK |
345 | # |
346 | CHECK_TYPE_SIZE("long long int" LONG_LONG_INT) | |
347 | CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG) | |
348 | CHECK_TYPE_SIZE("unsigned long long int" UNSIGNED_LONG_LONG_INT) | |
349 | ||
350 | # | |
351 | CHECK_TYPE_SIZE(dev_t DEV_T) | |
352 | IF(NOT HAVE_DEV_T) | |
353 | IF(MSVC) | |
354 | SET(dev_t "unsigned int") | |
355 | ENDIF(MSVC) | |
356 | ENDIF(NOT HAVE_DEV_T) | |
357 | # | |
358 | CHECK_TYPE_SIZE(gid_t GID_T) | |
359 | IF(NOT HAVE_GID_T) | |
360 | IF(WIN32) | |
361 | SET(gid_t "unsigned int") | |
362 | ELSEIF(WIN32) | |
363 | SET(gid_t int) | |
364 | ENDIF(WIN32) | |
365 | ENDIF(NOT HAVE_GID_T) | |
366 | # | |
367 | CHECK_TYPE_SIZE(id_t ID_T) | |
368 | IF(NOT HAVE_ID_T) | |
369 | SET(id_t int) | |
370 | ENDIF(NOT HAVE_ID_T) | |
371 | # | |
372 | CHECK_TYPE_SIZE(int64_t INT64_T) | |
373 | IF(NOT HAVE_INT64_T) | |
374 | IF(MSVC) | |
375 | SET(int64_t __int64) | |
376 | ENDIF(MSVC) | |
377 | ENDIF(NOT HAVE_INT64_T) | |
378 | # | |
379 | CHECK_TYPE_SIZE(intmax_t INTMAX_T) | |
380 | IF(NOT HAVE_INTMAX_T) | |
381 | IF(MSVC) | |
382 | SET(intmax_t "long long") | |
383 | ENDIF(MSVC) | |
384 | ENDIF(NOT HAVE_INTMAX_T) | |
385 | # | |
386 | CHECK_TYPE_SIZE(mode_t MODE_T) | |
387 | IF(NOT HAVE_MODE_T) | |
388 | IF(MSVC) | |
389 | SET(mode_t "unsigned short") | |
390 | ELSE(MSVC) | |
391 | SET(mode_t "int") | |
392 | ENDIF(MSVC) | |
393 | ENDIF(NOT HAVE_MODE_T) | |
394 | # | |
395 | CHECK_TYPE_SIZE(off_t OFF_T) | |
396 | IF(NOT HAVE_OFF_T) | |
397 | SET(off_t "long long") | |
398 | ENDIF(NOT HAVE_OFF_T) | |
399 | # | |
400 | CHECK_TYPE_SIZE(pid_t PID_T) | |
401 | IF(NOT HAVE_PID_T) | |
402 | IF(MSVC) | |
403 | SET(pid_t "unsigned short") | |
404 | ENDIF(MSVC) | |
405 | ENDIF(NOT HAVE_PID_T) | |
406 | # | |
407 | CHECK_TYPE_SIZE(size_t SIZE_T) | |
408 | IF(NOT HAVE_SIZE_T) | |
409 | SET(size_t "unsigned int") | |
410 | ENDIF(NOT HAVE_SIZE_T) | |
411 | # | |
412 | CHECK_TYPE_SIZE(ssize_t SSIZE_T) | |
413 | IF(NOT HAVE_SSIZE_T) | |
414 | IF(MSVC) | |
415 | IF(CMAKE_CL_64) | |
416 | SET(ssize_t "__int64") | |
417 | ELSE(CMAKE_CL_64) | |
418 | SET(ssize_t "signed long") | |
419 | ENDIF(CMAKE_CL_64) | |
420 | ELSE(MSVC) | |
421 | SET(ssize_t "int") | |
422 | ENDIF(MSVC) | |
423 | ENDIF(NOT HAVE_SSIZE_T) | |
424 | # | |
425 | CHECK_TYPE_SIZE(uid_t UID_T) | |
426 | IF(NOT HAVE_UID_T) | |
427 | IF(WIN32) | |
428 | SET(uid_t "unsigned int") | |
429 | ELSEIF(WIN32) | |
430 | SET(uid_t int) | |
431 | ENDIF(WIN32) | |
432 | ENDIF(NOT HAVE_UID_T) | |
433 | # | |
434 | CHECK_TYPE_SIZE(uint16_t UINT16_T) | |
435 | IF(NOT HAVE_UINT16_T) | |
436 | IF(MSVC) | |
437 | SET(uint16_t "unsigned short") | |
438 | ENDIF(MSVC) | |
439 | ENDIF(NOT HAVE_UINT16_T) | |
440 | # | |
441 | CHECK_TYPE_SIZE(uint32_t UINT32_T) | |
442 | IF(NOT HAVE_UINT32_T) | |
443 | IF(MSVC) | |
444 | SET(uint32_t "unsigned int") | |
445 | ENDIF(MSVC) | |
446 | ENDIF(NOT HAVE_UINT32_T) | |
447 | # | |
448 | CHECK_TYPE_SIZE(uint64_t UINT64_T) | |
449 | IF(NOT HAVE_UINT64_T) | |
450 | IF(MSVC) | |
451 | SET(uint64_t "unsigned __int64") | |
452 | ENDIF(MSVC) | |
453 | ENDIF(NOT HAVE_UINT64_T) | |
454 | # | |
455 | CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) | |
456 | IF(NOT HAVE_UINTMAX_T) | |
457 | IF(MSVC) | |
458 | SET(uintmax_t "unsigned long long") | |
459 | ENDIF(MSVC) | |
460 | ENDIF(NOT HAVE_UINTMAX_T) | |
461 | ||
462 | # | |
87b05751 | 463 | # Check for Extended Attribute libraries, headers, and functions |
8b7ba998 | 464 | # |
806025f2 | 465 | IF(ENABLE_XATTR) |
8b7ba998 TK |
466 | CHECK_INCLUDE_FILE(attr/xattr.h HAVE_ATTR_XATTR_H) |
467 | CHECK_LIBRARY_EXISTS(attr "setxattr" "" HAVE_ATTR_LIB) | |
468 | IF(HAVE_ATTR_LIB) | |
469 | SET(CMAKE_REQUIRED_LIBRARIES "attr") | |
470 | ENDIF(HAVE_ATTR_LIB) | |
471 | CHECK_FUNCS(getxattr lgetxattr listxattr llistxattr fsetxattr lsetxattr) | |
806025f2 | 472 | ENDIF(ENABLE_XATTR) |
8b7ba998 TK |
473 | |
474 | # | |
87b05751 | 475 | # Check for ACL libraries, headers, and functions |
8b7ba998 TK |
476 | # |
477 | # The ACL support in libarchive is written against the POSIX1e draft, | |
478 | # which was never officially approved and varies quite a bit across | |
479 | # platforms. Worse, some systems have completely non-POSIX acl functions, | |
480 | # which makes the following checks rather more complex than I would like. | |
481 | # | |
806025f2 | 482 | IF(ENABLE_ACL) |
8b7ba998 TK |
483 | CHECK_LIBRARY_EXISTS(acl "acl_get_file" "" HAVE_ACL_LIB) |
484 | IF(HAVE_ACL_LIB) | |
485 | SET(CMAKE_REQUIRED_LIBRARIES "acl") | |
486 | ENDIF(HAVE_ACL_LIB) | |
487 | # | |
488 | CHECK_FUNCS(acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file) | |
489 | CHECK_TYPE_EXISTS(acl_permset_t "sys/types.h;sys/acl.h" HAVE_ACL_PERMSET_T) | |
490 | ||
491 | # The "acl_get_perm()" function was omitted from the POSIX draft. | |
492 | # (It's a pretty obvious oversight; otherwise, there's no way to | |
493 | # test for specific permissions in a permset.) Linux uses the obvious | |
494 | # name, FreeBSD adds _np to mark it as "non-Posix extension." | |
495 | # Test for both as a double-check that we really have POSIX-style ACL support. | |
496 | CHECK_SYMBOL_EXISTS(acl_get_perm | |
497 | "sys/types.h;sys/acl.h" HAVE_ACL_GET_PERM) | |
498 | CHECK_SYMBOL_EXISTS(acl_get_perm_np | |
499 | "sys/types.h;sys/acl.h" HAVE_ACL_GET_PERM_NP) | |
500 | ||
501 | # MacOS has an acl.h that isn't POSIX. It can be detected by | |
502 | # checking for ACL_USER | |
503 | CHECK_SYMBOL_EXISTS(ACL_USER "sys/acl.h" HAVE_ACL_USER) | |
504 | ||
806025f2 | 505 | ENDIF(ENABLE_ACL) |
8b7ba998 | 506 | |
28f488bd TK |
507 | # Generate "config.h" from "cmake/config.h.in" |
508 | CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.h.in | |
806025f2 | 509 | ${CMAKE_CURRENT_BINARY_DIR}/config.h) |
3133e6d6 TK |
510 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) |
511 | ADD_DEFINITIONS(-DHAVE_CONFIG_H) | |
8b7ba998 | 512 | |
87b05751 | 513 | ############################################ |
8b7ba998 | 514 | # |
87b05751 | 515 | # How to build libarchive |
8b7ba998 | 516 | # |
87b05751 | 517 | ############################################ |
8b7ba998 TK |
518 | SET(include_HEADERS |
519 | libarchive/archive.h | |
520 | libarchive/archive_write_private.h | |
521 | ) | |
522 | ||
523 | SET(libarchive_SOURCES | |
524 | libarchive/archive_check_magic.c | |
525 | libarchive/archive_endian.h | |
526 | libarchive/archive_entry.c | |
527 | libarchive/archive_entry.h | |
528 | libarchive/archive_entry_copy_stat.c | |
529 | libarchive/archive_entry_link_resolver.c | |
530 | libarchive/archive_entry_private.h | |
531 | libarchive/archive_entry_stat.c | |
532 | libarchive/archive_entry_strmode.c | |
533 | libarchive/archive_platform.h | |
534 | libarchive/archive_private.h | |
535 | libarchive/archive_read.c | |
536 | libarchive/archive_read_data_into_fd.c | |
537 | libarchive/archive_read_disk.c | |
538 | libarchive/archive_read_disk_entry_from_file.c | |
539 | libarchive/archive_read_disk_private.h | |
540 | libarchive/archive_read_disk_set_standard_lookup.c | |
541 | libarchive/archive_read_extract.c | |
542 | libarchive/archive_read_open_fd.c | |
543 | libarchive/archive_read_open_file.c | |
544 | libarchive/archive_read_open_filename.c | |
545 | libarchive/archive_read_open_memory.c | |
546 | libarchive/archive_read_private.h | |
547 | libarchive/archive_read_support_compression_all.c | |
548 | libarchive/archive_read_support_compression_bzip2.c | |
549 | libarchive/archive_read_support_compression_compress.c | |
550 | libarchive/archive_read_support_compression_gzip.c | |
551 | libarchive/archive_read_support_compression_none.c | |
552 | libarchive/archive_read_support_compression_program.c | |
553 | libarchive/archive_read_support_compression_lzma.c | |
554 | libarchive/archive_read_support_format_all.c | |
555 | libarchive/archive_read_support_format_ar.c | |
556 | libarchive/archive_read_support_format_cpio.c | |
557 | libarchive/archive_read_support_format_empty.c | |
558 | libarchive/archive_read_support_format_iso9660.c | |
559 | libarchive/archive_read_support_format_mtree.c | |
560 | libarchive/archive_read_support_format_tar.c | |
561 | libarchive/archive_read_support_format_zip.c | |
562 | libarchive/archive_string.c | |
563 | libarchive/archive_string.h | |
564 | libarchive/archive_string_sprintf.c | |
565 | libarchive/archive_util.c | |
566 | libarchive/archive_virtual.c | |
567 | libarchive/archive_write.c | |
568 | libarchive/archive_write_disk.c | |
569 | libarchive/archive_write_disk_private.h | |
570 | libarchive/archive_write_disk_set_standard_lookup.c | |
571 | libarchive/archive_write_open_fd.c | |
572 | libarchive/archive_write_open_file.c | |
573 | libarchive/archive_write_open_filename.c | |
574 | libarchive/archive_write_open_memory.c | |
575 | libarchive/archive_write_set_compression_bzip2.c | |
576 | libarchive/archive_write_set_compression_compress.c | |
577 | libarchive/archive_write_set_compression_gzip.c | |
578 | libarchive/archive_write_set_compression_none.c | |
579 | libarchive/archive_write_set_compression_program.c | |
580 | libarchive/archive_write_set_format.c | |
581 | libarchive/archive_write_set_format_ar.c | |
582 | libarchive/archive_write_set_format_by_name.c | |
583 | libarchive/archive_write_set_format_cpio.c | |
584 | libarchive/archive_write_set_format_cpio_newc.c | |
585 | libarchive/archive_write_set_format_mtree.c | |
586 | libarchive/archive_write_set_format_pax.c | |
587 | libarchive/archive_write_set_format_shar.c | |
588 | libarchive/archive_write_set_format_ustar.c | |
589 | libarchive/filter_fork.c | |
590 | libarchive/filter_fork.h | |
591 | ) | |
592 | ||
593 | SET(libarchive_MANS | |
594 | libarchive/archive_entry.3 | |
595 | libarchive/archive_read.3 | |
596 | libarchive/archive_util.3 | |
597 | libarchive/archive_write.3 | |
598 | libarchive/archive_write_disk.3 | |
599 | libarchive/cpio.5 | |
600 | libarchive/libarchive.3 | |
601 | libarchive/libarchive_internals.3 | |
602 | libarchive/libarchive-formats.5 | |
603 | libarchive/mtree.5 | |
604 | libarchive/tar.5 | |
605 | ) | |
606 | ||
607 | IF(WIN32) | |
608 | LIST(APPEND libarchive_SOURCES libarchive/archive_windows.c) | |
609 | LIST(APPEND libarchive_SOURCES libarchive/archive_windows.h) | |
610 | ENDIF(WIN32) | |
611 | ||
8b7ba998 | 612 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/libarchive) |
8b7ba998 TK |
613 | # |
614 | IF(MSVC) | |
615 | ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) | |
616 | ENDIF(MSVC) | |
87b05751 | 617 | # Libarchive is a library |
8b7ba998 TK |
618 | ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) |
619 | TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) | |
620 | SET_PROPERTY(TARGET archive PROPERTY RUNTIME_OUTPUT_DIRECTORY | |
621 | "${CMAKE_CURRENT_BINARY_DIR}/lib") | |
622 | ||
87b05751 TK |
623 | ############################################ |
624 | # | |
625 | # How to build libarchive_test | |
626 | # | |
627 | ############################################ | |
806025f2 TK |
628 | IF(ENABLE_TEST) |
629 | SET(libarchive_test_SOURCES | |
630 | ${libarchive_SOURCES} | |
631 | libarchive/test/main.c | |
632 | libarchive/test/read_open_memory.c | |
633 | libarchive/test/test.h | |
634 | libarchive/test/test_acl_basic.c | |
635 | libarchive/test/test_acl_freebsd.c | |
636 | libarchive/test/test_acl_pax.c | |
637 | libarchive/test/test_archive_api_feature.c | |
638 | libarchive/test/test_bad_fd.c | |
639 | libarchive/test/test_compat_bzip2.c | |
640 | libarchive/test/test_compat_gtar.c | |
641 | libarchive/test/test_compat_gzip.c | |
642 | libarchive/test/test_compat_tar_hardlink.c | |
643 | libarchive/test/test_compat_zip.c | |
644 | libarchive/test/test_empty_write.c | |
645 | libarchive/test/test_entry.c | |
646 | libarchive/test/test_extattr_freebsd.c | |
647 | libarchive/test/test_fuzz.c | |
648 | libarchive/test/test_link_resolver.c | |
649 | libarchive/test/test_pax_filename_encoding.c | |
650 | libarchive/test/test_read_compress_program.c | |
651 | libarchive/test/test_read_data_large.c | |
652 | libarchive/test/test_read_disk.c | |
653 | libarchive/test/test_read_extract.c | |
654 | libarchive/test/test_read_format_ar.c | |
655 | libarchive/test/test_read_format_cpio_bin.c | |
656 | libarchive/test/test_read_format_cpio_bin_Z.c | |
657 | libarchive/test/test_read_format_cpio_bin_bz2.c | |
658 | libarchive/test/test_read_format_cpio_bin_gz.c | |
659 | libarchive/test/test_read_format_cpio_odc.c | |
660 | libarchive/test/test_read_format_cpio_svr4_gzip.c | |
661 | libarchive/test/test_read_format_cpio_svr4c_Z.c | |
662 | libarchive/test/test_read_format_empty.c | |
663 | libarchive/test/test_read_format_gtar_gz.c | |
664 | libarchive/test/test_read_format_gtar_lzma.c | |
665 | libarchive/test/test_read_format_gtar_sparse.c | |
666 | libarchive/test/test_read_format_iso_gz.c | |
667 | libarchive/test/test_read_format_isorr_bz2.c | |
668 | libarchive/test/test_read_format_mtree.c | |
669 | libarchive/test/test_read_format_pax_bz2.c | |
670 | libarchive/test/test_read_format_tar.c | |
671 | libarchive/test/test_read_format_tar_empty_filename.c | |
672 | libarchive/test/test_read_format_tbz.c | |
673 | libarchive/test/test_read_format_tgz.c | |
674 | libarchive/test/test_read_format_tz.c | |
675 | libarchive/test/test_read_format_zip.c | |
676 | libarchive/test/test_read_large.c | |
677 | libarchive/test/test_read_pax_truncated.c | |
678 | libarchive/test/test_read_position.c | |
679 | libarchive/test/test_read_truncated.c | |
680 | libarchive/test/test_tar_filenames.c | |
681 | libarchive/test/test_tar_large.c | |
682 | libarchive/test/test_ustar_filenames.c | |
683 | libarchive/test/test_write_compress.c | |
684 | libarchive/test/test_write_compress_program.c | |
685 | libarchive/test/test_write_disk.c | |
686 | libarchive/test/test_write_disk_failures.c | |
687 | libarchive/test/test_write_disk_hardlink.c | |
688 | libarchive/test/test_write_disk_perms.c | |
689 | libarchive/test/test_write_disk_secure.c | |
8ffc8720 | 690 | libarchive/test/test_write_disk_sparse.c |
806025f2 TK |
691 | libarchive/test/test_write_disk_times.c |
692 | libarchive/test/test_write_format_ar.c | |
693 | libarchive/test/test_write_format_cpio.c | |
694 | libarchive/test/test_write_format_cpio_empty.c | |
695 | libarchive/test/test_write_format_cpio_odc.c | |
696 | libarchive/test/test_write_format_cpio_newc.c | |
697 | libarchive/test/test_write_format_pax.c | |
698 | libarchive/test/test_write_format_shar_empty.c | |
699 | libarchive/test/test_write_format_tar.c | |
700 | libarchive/test/test_write_format_tar_empty.c | |
701 | libarchive/test/test_write_format_tar_ustar.c | |
702 | libarchive/test/test_write_open_memory.c | |
703 | ) | |
8b7ba998 | 704 | |
806025f2 TK |
705 | # |
706 | # Generate the list.h | |
707 | # | |
708 | GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/libarchive/test/list.h | |
709 | ${libarchive_test_SOURCES}) | |
710 | ADD_EXECUTABLE(libarchive_test ${libarchive_test_SOURCES}) | |
711 | TARGET_LINK_LIBRARIES(libarchive_test ${ADDITIONAL_LIBS}) | |
2ef11b4d MN |
712 | SET_PROPERTY(TARGET libarchive_test PROPERTY COMPILE_DEFINITIONS |
713 | LIBARCHIVE_STATIC) | |
f34cab9f MN |
714 | SET_PROPERTY(TARGET libarchive_test APPEND PROPERTY COMPILE_DEFINITIONS |
715 | LIST_H="${CMAKE_CURRENT_BINARY_DIR}/libarchive/test/list.h") | |
806025f2 TK |
716 | ADD_TEST(libarchive_test libarchive_test |
717 | -r ${CMAKE_CURRENT_SOURCE_DIR}/libarchive/test) | |
718 | ENDIF(ENABLE_TEST) | |
8b7ba998 | 719 | |
87b05751 | 720 | ############################################ |
8b7ba998 | 721 | # |
87b05751 | 722 | # How to build bsdtar |
8b7ba998 | 723 | # |
87b05751 | 724 | ############################################ |
806025f2 | 725 | IF (ENABLE_TAR) |
8b7ba998 TK |
726 | YACC_FILE(tar/getdate.y) |
727 | SET(bsdtar_SOURCES | |
728 | tar/bsdtar.c | |
729 | tar/bsdtar.h | |
730 | tar/bsdtar_platform.h | |
731 | tar/cmdline.c | |
732 | tar/getdate.c | |
733 | tar/matching.c | |
734 | tar/read.c | |
735 | tar/siginfo.c | |
736 | tar/subst.c | |
737 | tar/tree.c | |
738 | tar/tree.h | |
739 | tar/util.c | |
740 | tar/write.c | |
741 | ) | |
742 | ||
743 | SET(bsdtar_MANS tar/bsdtar.1) | |
744 | ||
745 | # | |
746 | # Register target | |
747 | # | |
748 | ADD_EXECUTABLE(bsdtar ${bsdtar_SOURCES} ${include_HEADERS}) | |
749 | TARGET_LINK_LIBRARIES(bsdtar archive ${ADDITIONAL_LIBS}) | |
806025f2 | 750 | ENDIF(ENABLE_TAR) |
8b7ba998 | 751 | |
87b05751 TK |
752 | ############################################ |
753 | # | |
754 | # How to build bsdtar_test | |
755 | # | |
756 | ############################################ | |
806025f2 | 757 | IF(ENABLE_TAR AND ENABLE_TEST) |
8b7ba998 TK |
758 | SET(bsdtar_test_SOURCES |
759 | tar/getdate.c | |
760 | tar/test/main.c | |
761 | tar/test/test.h | |
762 | tar/test/test_0.c | |
763 | tar/test/test_basic.c | |
764 | tar/test/test_copy.c | |
765 | tar/test/test_getdate.c | |
766 | tar/test/test_help.c | |
767 | tar/test/test_option_T.c | |
768 | tar/test/test_option_q.c | |
769 | tar/test/test_option_s.c | |
770 | tar/test/test_patterns.c | |
771 | tar/test/test_stdio.c | |
772 | tar/test/test_strip_components.c | |
773 | tar/test/test_symlink_dir.c | |
774 | tar/test/test_version.c | |
775 | ) | |
776 | ||
777 | # | |
778 | # Generate the list.h | |
779 | # | |
806025f2 TK |
780 | GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/tar/test/list.h |
781 | ${bsdtar_test_SOURCES}) | |
8b7ba998 TK |
782 | # |
783 | # Register target | |
784 | # | |
806025f2 | 785 | ADD_EXECUTABLE(bsdtar_test ${bsdtar_test_SOURCES}) |
f34cab9f MN |
786 | SET_PROPERTY(TARGET bsdtar_test PROPERTY COMPILE_DEFINITIONS |
787 | LIST_H="${CMAKE_CURRENT_BINARY_DIR}/tar/test/list.h") | |
806025f2 TK |
788 | ADD_TEST(bsdtar_test bsdtar_test |
789 | -v | |
790 | -p ${CMAKE_CURRENT_BINARY_DIR}/bsdtar | |
791 | -r ${CMAKE_CURRENT_SOURCE_DIR}/tar/test) | |
8b7ba998 | 792 | |
806025f2 | 793 | ENDIF (ENABLE_TAR AND ENABLE_TEST) |
8b7ba998 | 794 | |
87b05751 | 795 | ############################################ |
8b7ba998 | 796 | # |
87b05751 | 797 | # How to build bsdcpio |
8b7ba998 | 798 | # |
87b05751 | 799 | ############################################ |
806025f2 | 800 | IF(ENABLE_CPIO) |
8b7ba998 TK |
801 | SET(bsdcpio_SOURCES |
802 | cpio/cmdline.c | |
803 | cpio/cpio.c | |
804 | cpio/cpio.h | |
805 | cpio/cpio_platform.h | |
806 | cpio/err.c | |
807 | cpio/matching.c | |
808 | cpio/matching.h | |
809 | cpio/pathmatch.c | |
810 | cpio/pathmatch.h | |
811 | ) | |
812 | ||
813 | # | |
814 | # Register target | |
815 | # | |
816 | ADD_EXECUTABLE(bsdcpio ${bsdcpio_SOURCES} ${include_HEADERS}) | |
817 | TARGET_LINK_LIBRARIES(bsdcpio archive ${ADDITIONAL_LIBS}) | |
806025f2 | 818 | ENDIF(ENABLE_CPIO) |
8b7ba998 | 819 | |
87b05751 TK |
820 | ############################################ |
821 | # | |
822 | # How to build bsdcpio_test | |
823 | # | |
824 | ############################################ | |
806025f2 | 825 | IF(ENABLE_CPIO AND ENABLE_TEST) |
8b7ba998 TK |
826 | SET(bsdcpio_test_SOURCES |
827 | cpio/cmdline.c | |
828 | cpio/err.c | |
829 | cpio/pathmatch.c | |
830 | cpio/test/main.c | |
831 | cpio/test/test.h | |
832 | cpio/test/test_0.c | |
833 | cpio/test/test_basic.c | |
834 | cpio/test/test_format_newc.c | |
835 | cpio/test/test_gcpio_compat.c | |
836 | cpio/test/test_option_B.c | |
837 | cpio/test/test_option_L.c | |
838 | cpio/test/test_option_a.c | |
839 | cpio/test/test_option_c.c | |
840 | cpio/test/test_option_d.c | |
841 | cpio/test/test_option_ell.c | |
842 | cpio/test/test_option_f.c | |
843 | cpio/test/test_option_help.c | |
844 | cpio/test/test_option_m.c | |
845 | cpio/test/test_option_t.c | |
846 | cpio/test/test_option_u.c | |
847 | cpio/test/test_option_version.c | |
848 | cpio/test/test_option_y.c | |
849 | cpio/test/test_option_z.c | |
850 | cpio/test/test_owner_parse.c | |
851 | cpio/test/test_passthrough_dotdot.c | |
852 | cpio/test/test_passthrough_reverse.c | |
853 | cpio/test/test_pathmatch.c | |
854 | ) | |
855 | ||
856 | SET(bsdcpio_MANS cpio/bsdcpio.1) | |
857 | ||
806025f2 TK |
858 | GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/cpio/test/list.h |
859 | ${bsdcpio_test_SOURCES}) | |
860 | ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES}) | |
f34cab9f MN |
861 | SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS |
862 | LIST_H="${CMAKE_CURRENT_BINARY_DIR}/cpio/test/list.h") | |
806025f2 | 863 | ADD_TEST(bsdcpio_test bsdcpio_test |
1f6aea79 | 864 | -v |
806025f2 TK |
865 | -p ${CMAKE_CURRENT_BINARY_DIR}/bsdcpio |
866 | -r ${CMAKE_CURRENT_SOURCE_DIR}/cpio/test) | |
8b7ba998 | 867 | |
806025f2 | 868 | ENDIF(ENABLE_CPIO AND ENABLE_TEST) |
8b7ba998 | 869 |