From: Joseph Huber Date: Tue, 25 Apr 2023 23:29:35 +0000 (-0500) Subject: [libc] Add path to include generated headers for hermetic tests X-Git-Tag: upstream/17.0.6~10290 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fb5a3bc8f81ddbfbec5118eb1a881de8c7bdf615;p=platform%2Fupstream%2Fllvm.git [libc] Add path to include generated headers for hermetic tests The generated header files live in the build directory's include path. When targeting a hermetic build we want to make sure we only use headers generated by the project itself if availible. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D149216 --- diff --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt index d905766..c5d403a 100644 --- a/libc/test/UnitTest/CMakeLists.txt +++ b/libc/test/UnitTest/CMakeLists.txt @@ -27,6 +27,10 @@ add_library( foreach(lib LibcUnitTest LibcHermeticTest) target_include_directories(${lib} PUBLIC ${LIBC_SOURCE_DIR}) + if(LLVM_LIBC_FULL_BUILD) + # If we are in full build mode, then we should use our own public headers. + target_include_directories(${lib} PRIVATE ${LIBC_BUILD_DIR}/include) + endif() target_compile_options(${lib} PRIVATE ${LIBC_HERMETIC_TEST_COMPILE_OPTIONS} -fno-exceptions -fno-rtti) add_dependencies(${lib} @@ -48,6 +52,10 @@ add_library( target_include_directories(LibcTestMain PUBLIC ${LIBC_SOURCE_DIR}) target_compile_options(LibcTestMain PRIVATE -fno-exceptions -fno-rtti) +if(LLVM_LIBC_FULL_BUILD) + target_include_directories(LibcTestMain PRIVATE ${LIBC_BUILD_DIR}/include) + target_compile_options(LibcTestMain PRIVATE ${LIBC_HERMETIC_TEST_COMPILE_OPTIONS}) +endif() add_dependencies(LibcTestMain LibcUnitTest) add_header_library(