From: Chris Bieneman Date: Thu, 1 Sep 2016 18:46:53 +0000 (+0000) Subject: [CMake] Don't copy headers on fully standalone X-Git-Tag: llvmorg-4.0.0-rc1~10856 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd715f84a49aaf35b3b90eb204462f1ddddbddac;p=platform%2Fupstream%2Fllvm.git [CMake] Don't copy headers on fully standalone In r280108 I tried to make the headers copy relative to LLVM_BINARY_DIR, and the intent was that it would only happen on in-tree builds or runtimes directory builds. It didn't actually work that way. This patch adds a check for CMAKE_SOURCE_DIR being equal to CMAKE_CURRENT_SOURCE_DIR. In this case we set a variable LIBCXX_USING_INSTLLED_LLVM. This doesn't necessarily mean the LLVM is installed (it could be a build directory), but it means we need to treat the LLVM directory as read-only. llvm-svn: 280400 --- diff --git a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake index 934dfcd..349d234 100644 --- a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake +++ b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake @@ -61,8 +61,16 @@ macro(find_llvm_parts) set(LLVM_FOUND ON) endmacro(find_llvm_parts) +# If this is a standalone build not running as an external project of LLVM +# we need to later make some decisions differently. +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + # The intent is that this doesn't necessarily mean the LLVM is installed (it + # could be a build directory), but it means we need to treat the LLVM + # directory as read-only. + set(LIBCXX_USING_INSTLLED_LLVM 1) +endif() -if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBCXX_STANDALONE_BUILD) +if (LIBCXX_USING_INSTLLED_LLVM OR LIBCXX_STANDALONE_BUILD) set(LIBCXX_STANDALONE_BUILD 1) message(STATUS "Configuring for standalone build.") diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index 40ab262..1ad6aa1 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -10,7 +10,7 @@ set(LIBCXX_HEADER_PATTERN ${LIBCXX_SUPPORT_HEADER_PATTERN} ) -if(LLVM_BINARY_DIR) +if(NOT LIBCXX_USING_INSTLLED_LLVM) file(COPY . DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1" FILES_MATCHING