[PATCH] D25093: [libcxx] [cmake] Allow testing against installed LLVM with no sources

Michał Górny via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 30 07:25:09 PDT 2016


mgorny created this revision.
mgorny added reviewers: EricWF, beanz.
mgorny added a subscriber: cfe-commits.

Adjust the stand-alone build files to accept either CMake files from LLVM_CMAKE_PATH or from LLVM_MAIN_SRC_DIR instead of requiring both.  This makes it possible to run libcxx  tests on top of installed LLVM and lit, without having to unpack a copy of LLVM sources. Furthermore, it avoids adding duplicate paths.


https://reviews.llvm.org/D25093

Files:
  cmake/Modules/HandleOutOfTreeLLVM.cmake


Index: cmake/Modules/HandleOutOfTreeLLVM.cmake
===================================================================
--- cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -43,21 +43,16 @@
     return()
   endif()
 
-  if (NOT EXISTS ${LLVM_MAIN_SRC_DIR})
-    set(LLVM_FOUND OFF)
-    message(WARNING "Not found: ${LLVM_MAIN_SRC_DIR}")
-    return()
-  endif()
-
-  if(NOT EXISTS ${LLVM_CMAKE_PATH})
+  if (EXISTS "${LLVM_CMAKE_PATH}")
+    list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
+  elseif (EXISTS "${LLVM_MAIN_SRC_DIR}/cmake/modules")
+    list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
+  else()
     set(LLVM_FOUND OFF)
-    message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
+    message(WARNING "Neither ${LLVM_CMAKE_PATH} nor ${LLVM_MAIN_SRC_DIR}/cmake/modules found")
     return()
   endif()
 
-  list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
-  list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
-
   set(LLVM_FOUND ON)
 endmacro(find_llvm_parts)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25093.73048.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160930/ab05edda/attachment.bin>


More information about the cfe-commits mailing list