summaryrefslogtreecommitdiff
path: root/libc/src/__support/File/CMakeLists.txt
blob: 79de9250c642b1e61b8131a012c318eb353857cd (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
55
56
57
58
59
60
61
62
if(NOT (TARGET libc.src.__support.threads.mutex))
  # Not all platforms have a mutex implementation. If mutex is unvailable,
  # we just skip everything about files.
  return()
endif()

add_object_library(
  file
  SRCS
    file.cpp
  HDRS
    file.h
  DEPENDS
    libc.src.__support.CPP.new
    libc.src.__support.CPP.span
    libc.src.__support.threads.mutex
    libc.src.__support.error_or
)

add_object_library(
  dir
  SRCS
    dir.cpp
  HDRS
    dir.h
  DEPENDS
    libc.src.__support.CPP.new
    libc.src.__support.CPP.span
    libc.src.__support.threads.mutex
)

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}_file.cpp)
  add_object_library(
    platform_file
    SRCS
      ${LIBC_TARGET_OS}_file.cpp
    DEPENDS
      .file
      libc.include.fcntl
      libc.include.stdio
      libc.include.sys_syscall
      libc.src.__support.CPP.new
      libc.src.__support.OSUtil.osutil
      libc.src.errno.errno
      libc.src.__support.error_or
  )
endif()

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}_dir.cpp)
  add_object_library(
    platform_dir
    SRCS
      ${LIBC_TARGET_OS}_dir.cpp
    DEPENDS
      .dir
      libc.include.fcntl
      libc.include.sys_syscall
      libc.src.__support.OSUtil.osutil
      libc.src.__support.error_or
      libc.src.errno.errno
  )
endif()