[libcxx] r280400 - [CMake] Don't copy headers on fully standalone

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 1 11:46:53 PDT 2016


Author: cbieneman
Date: Thu Sep  1 13:46:53 2016
New Revision: 280400

URL: http://llvm.org/viewvc/llvm-project?rev=280400&view=rev
Log:
[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.

Modified:
    libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
    libcxx/trunk/include/CMakeLists.txt

Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=280400&r1=280399&r2=280400&view=diff
==============================================================================
--- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Thu Sep  1 13:46:53 2016
@@ -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.")
 

Modified: libcxx/trunk/include/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=280400&r1=280399&r2=280400&view=diff
==============================================================================
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Thu Sep  1 13:46:53 2016
@@ -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




More information about the cfe-commits mailing list