summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2017-09-14 18:23:43 +0000
committerShoaib Meenai <smeenai@fb.com>2017-09-14 18:23:43 +0000
commit0a2af12aff46999f2d7547581b89630bbe908e76 (patch)
treea719e08938c3b1ce27f984f9388251a90b4130e8 /CMakeLists.txt
parent5f919fe349450b3da0e29611ae37f6a940179290 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313284 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 66db8626f..e402dae66 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -615,9 +615,10 @@ if (DEFINED WIN32 AND LIBCXX_ENABLE_STATIC AND NOT LIBCXX_ENABLE_SHARED)
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()
#===============================================================================