diff --git a/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt b/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt --- a/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt +++ b/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt @@ -2,7 +2,6 @@ project(custom-libcxx C CXX) # Build static libcxxabi. -set(LIBCXXABI_STANDALONE_BUILD 1) set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "") set(LIBCXXABI_ENABLE_EXCEPTIONS ON CACHE BOOL "") set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE STRING "") @@ -11,7 +10,6 @@ add_subdirectory(${COMPILER_RT_LIBCXXABI_PATH} ${CMAKE_CURRENT_BINARY_DIR}/cxxabi) # Build static libcxx without exceptions. -set(LIBCXX_STANDALONE_BUILD 1) set(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY OFF CACHE BOOL "") set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "") diff --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt --- a/compiler-rt/lib/fuzzer/CMakeLists.txt +++ b/compiler-rt/lib/fuzzer/CMakeLists.txt @@ -161,11 +161,11 @@ -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF -DLIBCXX_ABI_NAMESPACE=__Fuzzer) - target_compile_options(RTfuzzer.${arch} PRIVATE -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) + target_compile_options(RTfuzzer.${arch} PRIVATE -cxx-isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) add_dependencies(RTfuzzer.${arch} libcxx_fuzzer_${arch}-build) - target_compile_options(RTfuzzer_main.${arch} PRIVATE -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) + target_compile_options(RTfuzzer_main.${arch} PRIVATE -cxx-isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) add_dependencies(RTfuzzer_main.${arch} libcxx_fuzzer_${arch}-build) - target_compile_options(RTfuzzer_interceptors.${arch} PRIVATE -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) + target_compile_options(RTfuzzer_interceptors.${arch} PRIVATE -cxx-isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) add_dependencies(RTfuzzer_interceptors.${arch} libcxx_fuzzer_${arch}-build) partially_link_libcxx(fuzzer_no_main ${LIBCXX_${arch}_PREFIX} ${arch}) partially_link_libcxx(fuzzer_interceptors ${LIBCXX_${arch}_PREFIX} ${arch}) diff --git a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt --- a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt +++ b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt @@ -64,7 +64,7 @@ COMPILER_RT_LIBCXXABI_PATH) file(GLOB libfuzzer_headers ../*.h) set(LIBFUZZER_TEST_RUNTIME_DEPS libcxx_fuzzer_${arch}-build ${libfuzzer_headers}) - set(LIBFUZZER_TEST_RUNTIME_CFLAGS -isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) + set(LIBFUZZER_TEST_RUNTIME_CFLAGS -cxx-isystem ${LIBCXX_${arch}_PREFIX}/include/c++/v1) set(LIBFUZZER_TEST_RUNTIME_LINK_FLAGS ${LIBCXX_${arch}_PREFIX}/lib/libc++.a) endif() diff --git a/compiler-rt/lib/msan/tests/CMakeLists.txt b/compiler-rt/lib/msan/tests/CMakeLists.txt --- a/compiler-rt/lib/msan/tests/CMakeLists.txt +++ b/compiler-rt/lib/msan/tests/CMakeLists.txt @@ -66,7 +66,7 @@ KIND ${kind} COMPILE_DEPS ${MSAN_UNITTEST_HEADERS} DEPS gtest msan - CFLAGS -isystem ${CMAKE_CURRENT_BINARY_DIR}/../libcxx_msan_${arch}/include/c++/v1 + CFLAGS -cxx-isystem ${CMAKE_CURRENT_BINARY_DIR}/../libcxx_msan_${arch}/include/c++/v1 ${MSAN_UNITTEST_INSTRUMENTED_CFLAGS} ${cflags} ) endmacro() diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -403,9 +403,11 @@ # Configure System #=============================================================================== +# TODO: Other projects rely on the location where we generate the libc++ headers +# internally. We should get rid of these dependencies. if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) - set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) + set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1") set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++) if(LIBCXX_LIBDIR_SUBDIR) string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR}) @@ -413,11 +415,11 @@ endif() elseif(LLVM_LIBRARY_OUTPUT_INTDIR) set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) - set(LIBCXX_HEADER_DIR ${LLVM_BINARY_DIR}) + set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1") set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) else() set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}) - set(LIBCXX_HEADER_DIR ${CMAKE_BINARY_DIR}) + set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1") set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX}) endif() diff --git a/libcxx/benchmarks/CMakeLists.txt b/libcxx/benchmarks/CMakeLists.txt --- a/libcxx/benchmarks/CMakeLists.txt +++ b/libcxx/benchmarks/CMakeLists.txt @@ -10,7 +10,7 @@ set(BENCHMARK_LIBCXX_COMPILE_FLAGS -Wno-unused-command-line-argument -nostdinc++ - -isystem ${LIBCXX_SOURCE_DIR}/include + -cxx-isystem "${LIBCXX_GENERATED_INCLUDE_DIR}" -L${LIBCXX_LIBRARY_DIR} -Wl,-rpath,${LIBCXX_LIBRARY_DIR} ${SANITIZER_FLAGS} @@ -20,7 +20,6 @@ -L${LIBCXX_CXX_ABI_LIBRARY_PATH} -Wl,-rpath,${LIBCXX_CXX_ABI_LIBRARY_PATH}) endif() -list(APPEND BENCHMARK_LIBCXX_COMPILE_FLAGS -include "${LIBCXX_BINARY_DIR}/__config_site") split_list(BENCHMARK_LIBCXX_COMPILE_FLAGS) ExternalProject_Add(google-benchmark-libcxx diff --git a/libcxx/cmake/Modules/HandleLibCXXABI.cmake b/libcxx/cmake/Modules/HandleLibCXXABI.cmake --- a/libcxx/cmake/Modules/HandleLibCXXABI.cmake +++ b/libcxx/cmake/Modules/HandleLibCXXABI.cmake @@ -52,8 +52,10 @@ COMMENT "Copying C++ ABI header ${fpath}...") list(APPEND abilib_headers "${dst}") - if (LIBCXX_HEADER_DIR) - set(dst "${LIBCXX_HEADER_DIR}/include/c++/v1/${dstdir}/${fpath}") + if (LIBCXX_GENERATED_INCLUDE_DIR) # always true + # TODO: libc++ shouldn't be responsible for copying the libc++abi + # headers into the right location. + set(dst "${LIBCXX_GENERATED_INCLUDE_DIR}/include/c++/v1/${dstdir}/${fpath}") add_custom_command(OUTPUT ${dst} DEPENDS ${src} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} diff --git a/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst --- a/libcxx/docs/TestingLibcxx.rst +++ b/libcxx/docs/TestingLibcxx.rst @@ -37,6 +37,12 @@ $ /bin/llvm-lit -sv libcxx/test/std/depr/depr.c.headers/stdlib_h.pass.cpp # Run a single test $ /bin/llvm-lit -sv libcxx/test/std/atomics libcxx/test/std/threads # Test std::thread and std::atomic +In the default configuration, the tests are built against headers that form a +fake installation root of libc++. This installation root has to be updated when +changes are made to the headers, so you should re-run the `check-cxx-deps` target +before running the tests manually with `lit` when you make any sort of change, +including to the headers. + Sometimes you'll want to change the way LIT is running the tests. Custom options can be specified using the `--param==` flag. The most common option you'll want to change is the standard dialect (ie -std=c++XX). By default the diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -4,6 +4,7 @@ __bits __bsd_locale_defaults.h __bsd_locale_fallbacks.h + __config __debug __errc __functional_03 @@ -189,62 +190,29 @@ wctype.h ) -configure_file("__config_site.in" - "${LIBCXX_BINARY_DIR}/__config_site" - @ONLY) +if (LIBCXX_GENERATED_INCLUDE_DIR) # Always true + configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_DIR}/__config_site" @ONLY) -# Generate a custom __config header. The new header is created -# by prepending __config_site to the current __config header. -add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config - COMMAND ${Python3_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py - ${LIBCXX_BINARY_DIR}/__config_site - ${LIBCXX_SOURCE_DIR}/include/__config - -o ${LIBCXX_BINARY_DIR}/__generated_config - DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config - ${LIBCXX_BINARY_DIR}/__config_site -) -# Add a target that executes the generation commands. -add_custom_target(cxx-generated-config ALL - DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config) - -if(LIBCXX_HEADER_DIR) - set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1) - - set(out_files) + set(_all_includes "${LIBCXX_GENERATED_INCLUDE_DIR}/__config_site") foreach(f ${files}) - set(src ${CMAKE_CURRENT_SOURCE_DIR}/${f}) - set(dst ${output_dir}/${f}) + set(src "${CMAKE_CURRENT_SOURCE_DIR}/${f}") + set(dst "${LIBCXX_GENERATED_INCLUDE_DIR}/${f}") add_custom_command(OUTPUT ${dst} DEPENDS ${src} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} COMMENT "Copying CXX header ${f}") - list(APPEND out_files ${dst}) + list(APPEND _all_includes "${dst}") endforeach() - # Copy the generated header as __config into build directory. - set(src ${LIBCXX_BINARY_DIR}/__generated_config) - set(dst ${output_dir}/__config) - add_custom_command(OUTPUT ${dst} - DEPENDS ${src} cxx-generated-config - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} - COMMENT "Copying CXX __config") - list(APPEND out_files ${dst}) - add_custom_target(generate-cxx-headers ALL DEPENDS ${out_files}) + add_custom_target(generate-cxx-headers DEPENDS ${_all_includes}) add_library(cxx-headers INTERFACE) add_dependencies(cxx-headers generate-cxx-headers ${LIBCXX_CXX_ABI_HEADER_TARGET}) # TODO: Use target_include_directories once we figure out why that breaks the runtimes build if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") - target_compile_options(cxx-headers INTERFACE /I "${output_dir}") - else() - target_compile_options(cxx-headers INTERFACE -I "${output_dir}") - endif() - - # Make sure the generated __config_site header is included when we build the library. - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") - target_compile_options(cxx-headers INTERFACE /FI "${LIBCXX_BINARY_DIR}/__config_site") + target_compile_options(cxx-headers INTERFACE /I "${LIBCXX_GENERATED_INCLUDE_DIR}") else() - target_compile_options(cxx-headers INTERFACE -include "${LIBCXX_BINARY_DIR}/__config_site") + target_compile_options(cxx-headers INTERFACE -I "${LIBCXX_GENERATED_INCLUDE_DIR}") endif() else() add_library(cxx-headers INTERFACE) @@ -260,16 +228,15 @@ ) endforeach() - # Install the generated header as __config. - install(FILES ${LIBCXX_BINARY_DIR}/__generated_config + # Install the generated __config_site. + install(FILES ${LIBCXX_GENERATED_INCLUDE_DIR}/__config_site DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - RENAME __config COMPONENT cxx-headers) if (NOT CMAKE_CONFIGURATION_TYPES) add_custom_target(install-cxx-headers - DEPENDS cxx-headers cxx-generated-config + DEPENDS cxx-headers COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=cxx-headers -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -10,6 +10,8 @@ #ifndef _LIBCPP_CONFIG #define _LIBCPP_CONFIG +#include <__config_site> + #if defined(_MSC_VER) && !defined(__clang__) # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER diff --git a/libcxx/test/configs/legacy.cfg.in b/libcxx/test/configs/legacy.cfg.in --- a/libcxx/test/configs/legacy.cfg.in +++ b/libcxx/test/configs/legacy.cfg.in @@ -3,6 +3,7 @@ import os import site +config.cxx_headers = "@LIBCXX_GENERATED_INCLUDE_DIR@" config.cxx_under_test = "@CMAKE_CXX_COMPILER@" config.project_obj_root = "@CMAKE_BINARY_DIR@" config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@" diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py --- a/libcxx/utils/libcxx/test/config.py +++ b/libcxx/utils/libcxx/test/config.py @@ -331,7 +331,6 @@ def configure_compile_flags_header_includes(self): support_path = os.path.join(self.libcxx_src_root, 'test', 'support') - self.configure_config_site_header() if self.cxx_stdlib_under_test != 'libstdc++' and \ not self.target_info.is_windows(): self.cxx.compile_flags += [ @@ -348,16 +347,12 @@ 'set_windows_crt_report_mode.h') ] cxx_headers = self.get_lit_conf('cxx_headers') - if cxx_headers == '' or (cxx_headers is None - and self.cxx_stdlib_under_test != 'libc++'): + if cxx_headers is None and self.cxx_stdlib_under_test != 'libc++': self.lit_config.note('using the system cxx headers') return self.cxx.compile_flags += ['-nostdinc++'] - if cxx_headers is None: - cxx_headers = os.path.join(self.libcxx_src_root, 'include') if not os.path.isdir(cxx_headers): - self.lit_config.fatal("cxx_headers='%s' is not a directory." - % cxx_headers) + self.lit_config.fatal("cxx_headers='{}' is not a directory.".format(cxx_headers)) self.cxx.compile_flags += ['-I' + cxx_headers] if self.libcxx_obj_root is not None: cxxabi_headers = os.path.join(self.libcxx_obj_root, 'include', @@ -365,16 +360,6 @@ if os.path.isdir(cxxabi_headers): self.cxx.compile_flags += ['-I' + cxxabi_headers] - def configure_config_site_header(self): - # Check for a possible __config_site in the build directory. We - # use this if it exists. - if self.libcxx_obj_root is None: - return - config_site_header = os.path.join(self.libcxx_obj_root, '__config_site') - if not os.path.isfile(config_site_header): - return - self.cxx.compile_flags += ['-include', config_site_header] - def configure_link_flags(self): # Configure library path self.configure_link_flags_cxx_library_path() diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -155,9 +155,23 @@ message(FATAL_ERROR "libc++abi must be built as either a shared or static library.") endif() -set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_PATH}/include" CACHE PATH - "Specify path to libc++ includes.") -message(STATUS "Libc++abi will be using libc++ includes from ${LIBCXXABI_LIBCXX_INCLUDES}") +# TODO: This is a hack for the fact that Standalone builds can't use targets +# from the other runtimes (so the cxx-headers target doesn't exist). +set(LIBCXXABI_LIBCXX_INCLUDES "" CACHE PATH + "Specify path to the installed libc++ includes. This is only relevant for Standalone builds, where the location of the headers can't be determined automatically.") +if (LIBCXXABI_STANDALONE_BUILD) + if (NOT IS_DIRECTORY ${LIBCXXABI_LIBCXX_INCLUDES}) + message(FATAL_ERROR + "LIBCXXABI_LIBCXX_INCLUDES=${LIBCXXABI_LIBCXX_INCLUDES} is not a valid directory. " + "Please provide the path to where the libc++ headers have been installed.") + endif() + add_library(cxx-headers INTERFACE) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") + target_compile_options(cxx-headers INTERFACE /I "${LIBCXXABI_LIBCXX_INCLUDES}") + else() + target_compile_options(cxx-headers INTERFACE -I "${LIBCXXABI_LIBCXX_INCLUDES}") + endif() +endif() option(LIBCXXABI_HERMETIC_STATIC_LIBRARY "Do not export any symbols from the static library." OFF) diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -55,8 +55,6 @@ endif() endif() -include_directories("${LIBCXXABI_LIBCXX_INCLUDES}") - # stdlib_stdexcept.cpp depends on libc++ internals. include_directories("${LIBCXXABI_LIBCXX_PATH}") @@ -177,7 +175,7 @@ # Build the shared library. if (LIBCXXABI_ENABLE_SHARED) add_library(cxxabi_shared SHARED ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS}) - target_link_libraries(cxxabi_shared PRIVATE ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES}) + target_link_libraries(cxxabi_shared PRIVATE cxx-headers ${LIBCXXABI_SHARED_LIBRARIES} ${LIBCXXABI_LIBRARIES}) if (TARGET pstl::ParallelSTL) target_link_libraries(cxxabi_shared PUBLIC pstl::ParallelSTL) endif() @@ -244,7 +242,7 @@ # Build the static library. if (LIBCXXABI_ENABLE_STATIC) add_library(cxxabi_static STATIC ${LIBCXXABI_SOURCES} ${LIBCXXABI_HEADERS}) - target_link_libraries(cxxabi_static PRIVATE ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES}) + target_link_libraries(cxxabi_static PRIVATE cxx-headers ${LIBCXXABI_STATIC_LIBRARIES} ${LIBCXXABI_LIBRARIES}) if (TARGET pstl::ParallelSTL) target_link_libraries(cxxabi_static PUBLIC pstl::ParallelSTL) endif() diff --git a/libcxxabi/test/libcxxabi/test/config.py b/libcxxabi/test/libcxxabi/test/config.py --- a/libcxxabi/test/libcxxabi/test/config.py +++ b/libcxxabi/test/libcxxabi/test/config.py @@ -56,10 +56,8 @@ super(Configuration, self).configure_compile_flags() def configure_compile_flags_header_includes(self): - self.configure_config_site_header() - cxx_headers = self.get_lit_conf( - 'cxx_headers', - os.path.join(self.libcxx_src_root, '/include')) + cxx_headers = self.get_lit_conf('cxx_headers', None) or \ + os.path.join(self.project_obj_root, 'include', 'c++', 'v1') if cxx_headers == '': self.lit_config.note('using the systems c++ headers') else: diff --git a/libunwind/test/libunwind/test/config.py b/libunwind/test/libunwind/test/config.py --- a/libunwind/test/libunwind/test/config.py +++ b/libunwind/test/libunwind/test/config.py @@ -52,8 +52,6 @@ super(Configuration, self).configure_compile_flags() def configure_compile_flags_header_includes(self): - self.configure_config_site_header() - libunwind_headers = self.get_lit_conf( 'libunwind_headers', os.path.join(self.libunwind_src_root, 'include')) diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -82,10 +82,6 @@ # these flags. if (NOT MSVC) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdinc++ -nostdlib++") - - if (LLVM_EXTERNAL_LIBCXX_SOURCE_DIR AND "libcxx" IN_LIST LLVM_ENABLE_RUNTIMES) - set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -isystem ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}/include") - endif() endif() # Avoid checking whether the compiler is working. @@ -96,9 +92,6 @@ include(HandleLLVMOptions) include(FindPythonInterp) -# Remove the -nostdlib++ option we've added earlier. -string(REPLACE "-nostdlib++" "" CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - # Use libtool instead of ar if you are both on an Apple host, and targeting Apple. if(CMAKE_HOST_APPLE AND APPLE) include(UseLibtool) @@ -114,12 +107,10 @@ string(REPLACE "-" "_" canon_name ${projName}) string(TOUPPER ${canon_name} canon_name) - # The subdirectories need to treat this as standalone builds. D57992 tried - # to get rid of this, but the runtimes treat *_STANDALONE_BUILD=OFF as if - # llvm & clang are configured in the same CMake, and setup dependencies - # against their targets. OpenMP has fixed the issue so we don't set the - # variable. - if (NOT ${canon_name} STREQUAL "OPENMP") + # compiler-rt needs to treat this as standalone builds. D57992 tried + # to get rid of it for compiler-rt, but it treats *_STANDALONE_BUILD=OFF + # as if llvm & clang are configured in the same CMake, and setup dependencies + if ("${canon_name}" STREQUAL "COMPILER_RT") set(${canon_name}_STANDALONE_BUILD ON) endif()