[libc-commits] [libc] fb5a3bc - [libc] Add path to include generated headers for hermetic tests

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Apr 26 14:52:43 PDT 2023


Author: Joseph Huber
Date: 2023-04-26T16:52:29-05:00
New Revision: fb5a3bc8f81ddbfbec5118eb1a881de8c7bdf615

URL: https://github.com/llvm/llvm-project/commit/fb5a3bc8f81ddbfbec5118eb1a881de8c7bdf615
DIFF: https://github.com/llvm/llvm-project/commit/fb5a3bc8f81ddbfbec5118eb1a881de8c7bdf615.diff

LOG: [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

Added: 
    

Modified: 
    libc/test/UnitTest/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt
index d9057665a9c6..c5d403a0c0f9 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(


        


More information about the libc-commits mailing list