summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibarchive/cpio/CMakeLists.txt
blob: 84934ad0cb65ad71115c634c977cedec6c6a1a62 (plain)
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
############################################
#
# How to build bsdcpio
#
############################################
IF(ENABLE_CPIO)

  SET(bsdcpio_SOURCES
    cmdline.c
    cpio.c
    cpio.h
    cpio_platform.h
    ../libarchive_fe/err.c
    ../libarchive_fe/err.h
    ../libarchive_fe/lafe_platform.h
    ../libarchive_fe/line_reader.c
    ../libarchive_fe/line_reader.h
    ../libarchive_fe/matching.c
    ../libarchive_fe/matching.h
    ../libarchive_fe/pathmatch.c
    ../libarchive_fe/pathmatch.h
  )
  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe)
  IF(WIN32 AND NOT CYGWIN)
    LIST(APPEND bsdcpio_SOURCES cpio_windows.c)
    LIST(APPEND bsdcpio_SOURCES cpio_windows.h)
  ENDIF(WIN32 AND NOT CYGWIN)

  # bsdcpio documentation
  SET(bsdcpio_MANS bsdcpio.1)

  # How to build bsdcpio
  ADD_EXECUTABLE(bsdcpio ${bsdcpio_SOURCES})
  IF(ENABLE_CPIO_SHARED)
    TARGET_LINK_LIBRARIES(bsdcpio archive ${ADDITIONAL_LIBS})
  ELSE(ENABLE_CPIO_SHARED)
    TARGET_LINK_LIBRARIES(bsdcpio archive_static ${ADDITIONAL_LIBS})
  ENDIF(ENABLE_CPIO_SHARED)
  # On Windows, DLL must end up in same dir with EXEs
  IF(WIN32 AND NOT CYGWIN)
    SET_TARGET_PROPERTIES(bsdcpio PROPERTIES
      RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
  ENDIF(WIN32 AND NOT CYGWIN)
  # Full path to the compiled executable (used by test suite)
  GET_TARGET_PROPERTY(BSDCPIO bsdcpio LOCATION)

  # Installation rules
  INSTALL(TARGETS bsdcpio RUNTIME DESTINATION bin)
  INSTALL_MAN(${bsdcpio_MANS})

ENDIF(ENABLE_CPIO)

# Test suite
add_subdirectory(test)