xref: /llvm-project/libc/src/errno/CMakeLists.txt (revision 4a68654ad6c4d85208b817fc914e17d084ed25ae)
1# If we are in full build mode, we will provide the errno definition ourselves,
2# and if we are in overlay mode, we will just re-use the system's errno.
3# We are passing LIBC_FULL_BUILD flag in full build mode so that the
4# implementation of libc_errno will know if we are in full build mode or not.
5
6# TODO: Move LIBC_FULL_BUILD flag to _get_common_compile_options.
7set(full_build_flag "")
8if(LLVM_LIBC_FULL_BUILD)
9  set(full_build_flag "-DLIBC_FULL_BUILD")
10endif()
11
12if(LIBC_CONF_ERRNO_MODE)
13  set(errno_config_copts "-DLIBC_ERRNO_MODE=${LIBC_CONF_ERRNO_MODE}")
14endif()
15
16add_entrypoint_object(
17  errno
18  SRCS
19    libc_errno.cpp
20  HDRS
21    libc_errno.h     # Include this
22  COMPILE_OPTIONS
23    ${full_build_flag}
24    ${errno_config_copts}
25  DEPENDS
26    libc.hdr.errno_macros
27    libc.src.__support.common
28)
29