[PATCH] D79837: [cmake] Update creation of object library dependencies for LINK_LIBS PUBLIC

Stephen Neuendorffer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 21:00:49 PDT 2020


stephenneuendorffer created this revision.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
stephenneuendorffer added a reviewer: mehdi_amini.

We need to avoid declaring dependencies on strings which are valid
LINK_LIBS and not valid targets.  Previously, we used if(TARGET) to
check this condition.  However, if(TARGET) checks whether a target has
been created (in the cmake subdirectory traversal order) and not
whether it *will* be created.  This results in annoying directory
ordering problems.

This patch changes the check to more explicitly eliminate problematic
libraries (namely -lpthread) using a REGEX.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79837

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -483,7 +483,8 @@
         "PUBLIC;PRIVATE"
         ${ARG_LINK_LIBS})
       foreach(link_lib ${LINK_LIBS_ARG_PUBLIC})
-        if(TARGET ${link_lib})
+        # Can't specify a dependence on -lpthread
+        if(NOT ${link_lib} MATCHES "-l.*")
           add_dependencies(${obj_name} ${link_lib})
         endif()
       endforeach()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79837.263598.patch
Type: text/x-patch
Size: 521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200513/70d10e43/attachment.bin>


More information about the llvm-commits mailing list