[libc++] Improve CMake include directory search.
authorMark de Wever <koraq@xs4all.nl>
Fri, 19 Nov 2021 15:43:27 +0000 (16:43 +0100)
committerMark de Wever <koraq@xs4all.nl>
Mon, 22 Nov 2021 16:35:49 +0000 (17:35 +0100)
This patch has been tested in D70631, but it should be reviewed
separately.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D114248

libcxx/src/CMakeLists.txt

index d52c530..c0e87bb 100644 (file)
@@ -197,6 +197,7 @@ split_list(LIBCXX_LINK_FLAGS)
 # Build the shared library.
 if (LIBCXX_ENABLE_SHARED)
   add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+  target_include_directories(cxx_shared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
   target_link_libraries(cxx_shared PUBLIC cxx-headers
                                    PRIVATE ${LIBCXX_LIBRARIES})
   set_target_properties(cxx_shared
@@ -275,6 +276,7 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
 # Build the static library.
 if (LIBCXX_ENABLE_STATIC)
   add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+  target_include_directories(cxx_static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
   target_link_libraries(cxx_static PUBLIC cxx-headers
                                    PRIVATE ${LIBCXX_LIBRARIES})
   set_target_properties(cxx_static