[PATCH] D104848: [cmake] Handled utils/unittests before projects

Jakub Chlanda via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 24 05:03:44 PDT 2021


jchlanda created this revision.
jchlanda added reviewers: bader, vladimirlaz, rnk.
Herald added a subscriber: mgorny.
jchlanda requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch makes sure that `utils/unittests` are handled before `projects` in cmake. It allows cmake targets that are created by projects to use utility targets, such as: `gtest` or `gtest_main`, that are created in `utils/unittests` subdirectory.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104848

Files:
  llvm/CMakeLists.txt


Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -956,6 +956,9 @@
   add_subdirectory(utils/count)
   add_subdirectory(utils/not)
   add_subdirectory(utils/yaml-bench)
+  if( LLVM_INCLUDE_TESTS )
+    add_subdirectory(utils/unittest)
+  endif()
 else()
   if ( LLVM_INCLUDE_TESTS )
     message(FATAL_ERROR "Including tests when not building utils will not work.
@@ -1000,9 +1003,6 @@
   add_subdirectory(utils/lit)
   add_subdirectory(test)
   add_subdirectory(unittests)
-  if( LLVM_INCLUDE_UTILS )
-    add_subdirectory(utils/unittest)
-  endif()
 
   if (WIN32)
     # This utility is used to prevent crashing tests from calling Dr. Watson on


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104848.354185.patch
Type: text/x-patch
Size: 744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210624/2639acdc/attachment.bin>


More information about the llvm-commits mailing list