diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -4,8 +4,12 @@ # should be built with the LLVM toolchain from the build directory. This file is # a first step to formalizing runtime build interfaces. -# In the current state this file only works with compiler-rt, other runtimes -# will work as the runtime build interface standardizes. +# Setting CMake minimum required version should be at the very top of the file +# if this is the entry point. +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) + cmake_minimum_required(VERSION 3.4.3) + project(Runtimes C CXX ASM) +endif() # Find all subdirectories containing CMake projects file(GLOB entries *) @@ -34,6 +38,15 @@ set(LLVM_EXTERNAL_${canon_name}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../${proj}") endforeach() +# On Apple platforms c++ headers come with the toolchain, not the sysroot, and +# when building with the runtimes we need to make sure the C++ headers are +# copied into plae before running any of the build. +if(APPLE) + if ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES) + execute_process(COMMAND ditto ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}/include ${LLVM_INCLUDE_DIR}/c++/v1/) + endif() +endif() + function(get_compiler_rt_path path) foreach(entry ${runtimes}) get_filename_component(projName ${entry} NAME)