Skip to content

[libc] Specify path for making include/ subdirs #66589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libc/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ add_gen_header(
)

# TODO: This should be conditional on POSIX networking being included.
file(MAKE_DIRECTORY "arpa")
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is CMAKE_CURRENT_BINARY_DIR more appropriate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. In the libc/CMakeLists.txt there's LIBC_INCLUDE_DIR is redefined a few times, one of which is:

elseif(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND LIBC_ENABLE_USE_BY_CLANG)
set(LIBC_INCLUDE_DIR ${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE})

Whereas LIBC_INCLUDE_DIR is implemented in terms of it:

set(LIBC_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)

Nothing else in this file refers to the CMAKE_CURRENT_BINARY_DIR, but there is other references to LIBC_INCLUDE_DIR:

target_include_directories(libc-headers SYSTEM INTERFACE ${LIBC_INCLUDE_DIR})

I'm not a CMake expert, though. I'm happy to adjust if that's better!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. ${LIBC_INCLUDE_PATH} is the correct path.


add_gen_header(
arpa_inet
Expand Down Expand Up @@ -280,7 +280,7 @@ add_gen_header(
# TODO: Not all platforms will have a include/sys directory. Add the sys
# directory and the targets for sys/*.h files conditional to the OS requiring
# them.
file(MAKE_DIRECTORY "sys")
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)

add_gen_header(
sys_auxv
Expand Down Expand Up @@ -497,7 +497,7 @@ add_gen_header(
)

if(LIBC_TARGET_ARCHITECTURE_IS_GPU)
file(MAKE_DIRECTORY "gpu")
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu)

add_gen_header(
gpu_rpc
Expand Down