[libcxx] r313284 - [libc++] Prevent stale site configuration headers

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 14 11:23:43 PDT 2017


Author: smeenai
Date: Thu Sep 14 11:23:43 2017
New Revision: 313284

URL: http://llvm.org/viewvc/llvm-project?rev=313284&view=rev
Log:
[libc++] Prevent stale site configuration headers

If we define cmake macros that require a site config, and then undefine
all such macros, a stale site config header will be left behind.
Explicitly delete any generate site config if we don't need one to avoid
this.

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

Modified:
    libcxx/trunk/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=313284&r1=313283&r2=313284&view=diff
==============================================================================
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Thu Sep 14 11:23:43 2017
@@ -615,9 +615,10 @@ if (DEFINED WIN32 AND LIBCXX_ENABLE_STAT
   config_define(ON _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
 endif()
 
+set(site_config_path "${LIBCXX_BINARY_DIR}/__config_site")
 if (LIBCXX_NEEDS_SITE_CONFIG)
   configure_file("include/__config_site.in"
-                 "${LIBCXX_BINARY_DIR}/__config_site"
+                 "${site_config_path}"
                  @ONLY)
 
   # Provide the config definitions by included the generated __config_site
@@ -627,6 +628,11 @@ if (LIBCXX_NEEDS_SITE_CONFIG)
   else()
     add_compile_flags("-include ${LIBCXX_BINARY_DIR}/__config_site")
   endif()
+else()
+  if (EXISTS "${site_config_path}")
+    message(STATUS "Removing stale site configuration ${site_config_path}")
+    file(REMOVE "${site_config_path}")
+  endif()
 endif()
 
 #===============================================================================




More information about the cfe-commits mailing list