[PATCH] D32836: CMake: Only add test/ subdirectory when it exists

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 3 16:36:05 PDT 2017


dexonsmith created this revision.
Herald added a subscriber: mgorny.

CMake: Only add test/ subdirectory when it exists

r296685 started adding the test/ subdirectory even when
LIBCXX_INCLUDE_TESTS=OFF.  This is great for testing libcxx standalone,
but it also breaks the build when the test/ subdirectory is removed
(and our submission system strips all test/ directories).

This patch updates the logic to check for test/ before adding it.

rdar://problem/31931366


https://reviews.llvm.org/D32836

Files:
  libcxx/CMakeLists.txt


Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -627,7 +627,12 @@
 # Create the lit.site.cfg file even when LIBCXX_INCLUDE_TESTS is OFF or
 # LLVM_FOUND is OFF. This allows users to run the tests manually using
 # LIT without requiring a full LLVM checkout.
-add_subdirectory(test)
+#
+# However, since some submission systems strip test/ subdirectories, check for
+# it before adding it.
+if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/test")
+  add_subdirectory(test)
+endif()
 if (LIBCXX_INCLUDE_TESTS)
   add_subdirectory(lib/abi)
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32836.97744.patch
Type: text/x-patch
Size: 646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170503/897e4c71/attachment-0001.bin>


More information about the cfe-commits mailing list