[llvm] 085234b - [cmake] Update creation of object library dependencies for LINK_LIBS PUBLIC
    Stephen Neuendorffer via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue May 12 22:37:27 PDT 2020
    
    
  
Author: Stephen Neuendorffer
Date: 2020-05-12T22:36:52-07:00
New Revision: 085234bedc3803699e58a8c9e6bbace3388efee2
URL: https://github.com/llvm/llvm-project/commit/085234bedc3803699e58a8c9e6bbace3388efee2
DIFF: https://github.com/llvm/llvm-project/commit/085234bedc3803699e58a8c9e6bbace3388efee2.diff
LOG: [cmake] Update creation of object library dependencies for LINK_LIBS PUBLIC
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.
Differential Revision: https://reviews.llvm.org/D79837
Added: 
    
Modified: 
    llvm/cmake/modules/AddLLVM.cmake
Removed: 
    
################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 6b10e2c4cd54..cf8f29975e42 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -483,7 +483,8 @@ function(llvm_add_library name)
         "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 "-.*")
           add_dependencies(${obj_name} ${link_lib})
         endif()
       endforeach()
        
    
    
More information about the llvm-commits
mailing list