summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/CMakeLists.txt24
-rw-r--r--libcxx/benchmarks/CMakeLists.txt4
-rw-r--r--libcxx/src/CMakeLists.txt2
3 files changed, 14 insertions, 16 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 54265633ff9..1f7dd57dfc9 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -809,20 +809,20 @@ if (LIBCXX_NEEDS_SITE_CONFIG)
configure_file("include/__config_site.in"
"${site_config_path}"
@ONLY)
+elseif(EXISTS "${site_config_path}")
+ message(STATUS "Removing stale site configuration ${site_config_path}")
+ file(REMOVE "${site_config_path}")
+endif()
- # Provide the config definitions by included the generated __config_site
- # file at compile time.
- if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
- add_compile_flags("/FI\"${LIBCXX_BINARY_DIR}/__config_site\"")
- 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}")
+function(cxx_add_config_site target)
+ if (LIBCXX_NEEDS_SITE_CONFIG)
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
+ target_compile_options(${target} PUBLIC "/FI\"${site_config_path}\"")
+ else()
+ target_compile_options(${target} PUBLIC "-include${site_config_path}")
+ endif()
endif()
-endif()
+endfunction()
#===============================================================================
# Setup Source Code And Tests
diff --git a/libcxx/benchmarks/CMakeLists.txt b/libcxx/benchmarks/CMakeLists.txt
index d80cb1af03a..56fadff1f93 100644
--- a/libcxx/benchmarks/CMakeLists.txt
+++ b/libcxx/benchmarks/CMakeLists.txt
@@ -95,10 +95,6 @@ set(BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS
${SANITIZER_FLAGS}
-Wno-user-defined-literals
)
-if (LIBCXX_NEEDS_SITE_CONFIG)
- list(APPEND BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS
- -include "${LIBCXX_BINARY_DIR}/__config_site")
-endif()
set(BENCHMARK_TEST_LIBCXX_LINK_FLAGS
-nodefaultlibs
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index c9c3f180870..93d48f1b7dc 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -234,6 +234,7 @@ if (LIBCXX_ENABLE_SHARED)
cxx_set_common_defines(cxx_shared)
cxx_add_warning_flags(cxx_shared)
cxx_add_windows_flags(cxx_shared)
+ cxx_add_config_site(cxx_shared)
# Link against LLVM libunwind
if (LIBCXXABI_USE_LLVM_UNWINDER)
@@ -337,6 +338,7 @@ if (LIBCXX_ENABLE_STATIC)
cxx_set_common_defines(cxx_static)
cxx_add_warning_flags(cxx_static)
cxx_add_windows_flags(cxx_static)
+ cxx_add_config_site(cxx_static)
if (LIBCXX_HERMETIC_STATIC_LIBRARY)
# If the hermetic library doesn't define the operator new/delete functions
OpenPOWER on IntegriCloud