[PATCH] D38444: [compiler-rt] [cmake] Create dummy gtest target for stand-alone builds

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 1 04:28:50 PDT 2017


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

Create a dummy 'gtest' target to satisfy the test dependencies while
doing stand-alone builds. Historically those dependencies were
conditional to non-stand-alone builds but the refactoring
in https://reviews.llvm.org/rL310971 has made them unconditional, breaking stand-alone builds
as a result.

Given the added complexity of maintaining a large number of conditionals
scattered around the different CMakeLists.txt files and the likeliness
of people mistakenly adding more unconditional dependencies, adding
a dummy target seems an easier way forward.


Repository:
  rL LLVM

https://reviews.llvm.org/D38444

Files:
  cmake/Modules/AddCompilerRT.cmake


Index: cmake/Modules/AddCompilerRT.cmake
===================================================================
--- cmake/Modules/AddCompilerRT.cmake
+++ cmake/Modules/AddCompilerRT.cmake
@@ -291,6 +291,12 @@
   -I${COMPILER_RT_GTEST_PATH}
 )
 
+if(COMPILER_RT_STANDALONE_BUILD)
+  # Add a dummy target to satisfy dependencies on GTest when building
+  # stand-alone. GTest itself is provided via COMPILER_RT_GTEST_SOURCES.
+  add_custom_target(gtest)
+endif()
+
 append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38444.117277.patch
Type: text/x-patch
Size: 663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171001/efc3c1f3/attachment.bin>


More information about the cfe-commits mailing list