[libcxx-commits] [PATCH] D65831: libc++: add `-include` or `/FI` to the interface compile definitions

Saleem Abdulrasool via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 6 15:07:13 PDT 2019


compnerd created this revision.
compnerd added reviewers: smeenai, beanz.
Herald added subscribers: libcxx-commits, ldionne, mgorny.
Herald added a reviewer: EricWF.

This ensures that when `libcxx_shared` or `libcxx_static` the site configuration is always included as appropriate.


Repository:
  rCXX libc++

https://reviews.llvm.org/D65831

Files:
  src/CMakeLists.txt


Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -238,6 +238,11 @@
 # Build the shared library.
 if (LIBCXX_ENABLE_SHARED)
   add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+  set_target_properties(cxx_shared PROPERTIES
+    INTERFACE_COMPILE_DEFINITIONS
+      $<$<CXX_COMPILER_ID:MSVC>:/FI>
+      $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-include>
+      ${LIBCXX_BINARY_DIR}/__config_site)
   if(COMMAND llvm_setup_rpath)
     llvm_setup_rpath(cxx_shared)
   endif()
@@ -343,6 +348,11 @@
 # Build the static library.
 if (LIBCXX_ENABLE_STATIC)
   add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
+  set_target_properties(cxx_static PROPERTIES
+    INTERFACE_COMPILE_DEFINITIONS
+      $<$<CXX_COMPILER_ID:MSVC>:/FI>
+      $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-include>
+      ${LIBCXX_BINARY_DIR}/__config_site)
   cxx_link_system_libraries(cxx_static)
   target_link_libraries(cxx_static PRIVATE ${LIBCXX_LIBRARIES})
   set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
@@ -410,6 +420,11 @@
   else()
     target_link_libraries(cxx_experimental cxx_static)
   endif()
+  set_target_properties(cxx_experimental PROPERTIES
+    INTERFACE_COMPILE_DEFINITIONS
+      $<$<CXX_COMPILER_ID:MSVC>:/FI>
+      $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-include>
+      ${LIBCXX_BINARY_DIR}/__config_site)
 
   set(experimental_flags "${LIBCXX_COMPILE_FLAGS}")
   check_flag_supported(-std=c++14)
@@ -431,6 +446,11 @@
   else()
     add_library(cxx_external_threads STATIC ${LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES})
   endif()
+  set_target_properties(cxx_external_threads PROPERTIES
+    INTERFACE_COMPILE_DEFINITIONS
+      $<$<CXX_COMPILER_ID:MSVC>:/FI>
+      $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-include>
+      ${LIBCXX_BINARY_DIR}/__config_site)
 
   set_target_properties(cxx_external_threads
     PROPERTIES


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65831.213731.patch
Type: text/x-patch
Size: 1953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190806/b8d1e7f3/attachment.bin>


More information about the libcxx-commits mailing list