summaryrefslogtreecommitdiff
path: root/cpio
diff options
context:
space:
mode:
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>2009-03-20 08:57:14 -0400
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>2009-03-20 08:57:14 -0400
commit968a8126fa8d6d19932087184bd3e7848be56a99 (patch)
tree43d80d0e653a9c6bc783fed4455bf541adde6222 /cpio
parent85ad12e222b36030adc44d82e3ffad2fe860bf0b (diff)
downloadlibarchive-968a8126fa8d6d19932087184bd3e7848be56a99.tar.gz
Split a CMakeLists.txt into each subdirectory, and remove
useless '#include LIST_H'. It was used for out-of-source build with the previous CMakeLists.txt. SVN-Revision: 823
Diffstat (limited to 'cpio')
-rw-r--r--cpio/CMakeLists.txt42
-rw-r--r--cpio/test/CMakeLists.txt58
-rw-r--r--cpio/test/main.c8
3 files changed, 100 insertions, 8 deletions
diff --git a/cpio/CMakeLists.txt b/cpio/CMakeLists.txt
new file mode 100644
index 00000000..05125c22
--- /dev/null
+++ b/cpio/CMakeLists.txt
@@ -0,0 +1,42 @@
+############################################
+#
+# How to build bsdcpio
+#
+############################################
+IF(ENABLE_CPIO)
+ SET(bsdcpio_SOURCES
+ cmdline.c
+ cpio.c
+ cpio.h
+ cpio_platform.h
+ err.c
+ matching.c
+ matching.h
+ pathmatch.c
+ pathmatch.h
+ )
+ IF(WIN32 AND NOT CYGWIN)
+ LIST(APPEND bsdcpio_SOURCES cpio_windows.c)
+ LIST(APPEND bsdcpio_SOURCES cpio_windows.h)
+ ENDIF(WIN32 AND NOT CYGWIN)
+
+ SET(bsdcpio_MANS bsdcpio.1)
+
+ #
+ # Register target
+ #
+ ADD_EXECUTABLE(bsdcpio ${bsdcpio_SOURCES})
+ IF(WIN32 AND NOT CYGWIN)
+ TARGET_LINK_LIBRARIES(bsdcpio archive ${ADDITIONAL_LIBS})
+ SET_TARGET_PROPERTIES(bsdcpio PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+ SET(BSDCPIO ${CMAKE_BINARY_DIR}/debug/bsdcpio.exe)
+ ELSE(WIN32 AND NOT CYGWIN)
+ TARGET_LINK_LIBRARIES(bsdcpio archive_static ${ADDITIONAL_LIBS})
+ SET(BSDCPIO ${CMAKE_CURRENT_BINARY_DIR}/bsdcpio)
+ ENDIF(WIN32 AND NOT CYGWIN)
+ INSTALL(TARGETS bsdcpio RUNTIME DESTINATION bin)
+ INSTALL_MAN(${bsdcpio_MANS})
+ENDIF(ENABLE_CPIO)
+
+add_subdirectory(test)
diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt
new file mode 100644
index 00000000..b984b100
--- /dev/null
+++ b/cpio/test/CMakeLists.txt
@@ -0,0 +1,58 @@
+############################################
+#
+# How to build bsdcpio_test
+#
+############################################
+IF(ENABLE_CPIO AND ENABLE_TEST)
+ SET(bsdcpio_test_SOURCES
+ ../cmdline.c
+ ../err.c
+ ../pathmatch.c
+ main.c
+ test.h
+ test_0.c
+ test_basic.c
+ test_format_newc.c
+ test_gcpio_compat.c
+ test_option_B.c
+ test_option_L.c
+ test_option_a.c
+ test_option_c.c
+ test_option_d.c
+ test_option_ell.c
+ test_option_f.c
+ test_option_help.c
+ test_option_m.c
+ test_option_t.c
+ test_option_u.c
+ test_option_version.c
+ test_option_y.c
+ test_option_z.c
+ test_owner_parse.c
+ test_passthrough_dotdot.c
+ test_passthrough_reverse.c
+ test_pathmatch.c
+ )
+ IF(WIN32 AND NOT CYGWIN)
+ LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.c)
+ LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.h)
+ ENDIF(WIN32 AND NOT CYGWIN)
+
+ #
+ # Generate the list.h
+ #
+ GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
+ ${bsdcpio_test_SOURCES})
+ SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
+ ${CMAKE_CURRENT_BINARY_DIR})
+ #
+ # Register target
+ #
+ ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES})
+ SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS LIST_H)
+ ADD_TEST(bsdcpio_test bsdcpio_test
+ -v
+ -p ${BSDCPIO}
+ -r ${CMAKE_CURRENT_SOURCE_DIR})
+ENDIF(ENABLE_CPIO AND ENABLE_TEST)
+
diff --git a/cpio/test/main.c b/cpio/test/main.c
index 8d10206b..3563f007 100644
--- a/cpio/test/main.c
+++ b/cpio/test/main.c
@@ -56,11 +56,7 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kient
*/
#undef DEFINE_TEST
#define DEFINE_TEST(name) void name(void);
-#ifdef LIST_H
-#include LIST_H
-#else
#include "list.h"
-#endif
/* Interix doesn't define these in a standard header. */
#if __INTERIX__
@@ -764,11 +760,7 @@ slurpfile(size_t * sizep, const char *fmt, ...)
#undef DEFINE_TEST
#define DEFINE_TEST(n) { n, #n },
struct { void (*func)(void); const char *name; } tests[] = {
-#ifdef LIST_H
- #include LIST_H
-#else
#include "list.h"
-#endif
};
/*