Skip to content

Revert "[CMake] Use keyword signature in two additional callsites (#1… - #184186

Merged
gulfemsavrun merged 1 commit into
llvm:mainfrom
gulfemsavrun:revert-cmake-changes
Mar 2, 2026
Merged

Revert "[CMake] Use keyword signature in two additional callsites (#1…#184186
gulfemsavrun merged 1 commit into
llvm:mainfrom
gulfemsavrun:revert-cmake-changes

Conversation

@gulfemsavrun

Copy link
Copy Markdown
Contributor

…83889)"

This reverts commit 2342db0.

Revert "[CMake] Propagate dependencies to OBJECT libraries in add_llvm_library (#183541)"

This reverts commit e3c0454.

…vm#183889)"

This reverts commit 2342db0.

Revert "[CMake] Propagate dependencies to OBJECT libraries in `add_llvm_library` (llvm#183541)"

This reverts commit e3c0454.
@llvmbot llvmbot added cmake Build system in general and CMake in particular lld mlir labels Mar 2, 2026
@llvmbot

llvmbot commented Mar 2, 2026

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-lld

@llvm/pr-subscribers-mlir

Author: None (gulfemsavrun)

Changes

…83889)"

This reverts commit 2342db0.

Revert "[CMake] Propagate dependencies to OBJECT libraries in add_llvm_library (#183541)"

This reverts commit e3c0454.


Full diff: https://github.com/llvm/llvm-project/pull/184186.diff

5 Files Affected:

  • (modified) clang/cmake/modules/AddClang.cmake (+1-1)
  • (modified) lld/tools/lld/CMakeLists.txt (+1-1)
  • (modified) llvm/cmake/modules/AddLLVM.cmake (+1-6)
  • (modified) llvm/cmake/modules/LLVM-Config.cmake (+1-4)
  • (modified) mlir/cmake/modules/AddMLIR.cmake (+1-1)
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index e2112d7c326e2..c811b7f459126 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -217,7 +217,7 @@ endmacro()
 
 function(clang_target_link_libraries target type)
   if (TARGET obj.${target})
-    target_link_libraries(obj.${target} ${type} ${ARGN})
+    target_link_libraries(obj.${target} ${ARGN})
   endif()
 
   get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
diff --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt
index 1d1a7ff448b7c..8498a91597a93 100644
--- a/lld/tools/lld/CMakeLists.txt
+++ b/lld/tools/lld/CMakeLists.txt
@@ -13,7 +13,7 @@ export_executable_symbols_for_plugins(lld)
 
 function(lld_target_link_libraries target type)
   if (TARGET obj.${target})
-    target_link_libraries(obj.${target} ${type} ${ARGN})
+    target_link_libraries(obj.${target} ${ARGN})
   endif()
 
   get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 386ffd99c570b..f59002bc6c837 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -636,12 +636,7 @@ function(llvm_add_library name)
     # Do add_dependencies(obj) later due to CMake issue 14747.
     list(APPEND objlibs ${obj_name})
 
-    # Bring in the target include directories and link info from our original
-    # target. target_link_libraries propagates transitive dependencies with
-    # proper SYSTEM include handling from IMPORTED targets.
-    # target_include_directories propagates include directories set directly on
-    # the target.
-    target_link_libraries(${obj_name} PRIVATE $<TARGET_PROPERTY:${name},LINK_LIBRARIES>)
+    # Bring in the target include directories from our original target.
     target_include_directories(${obj_name} PRIVATE $<TARGET_PROPERTY:${name},INCLUDE_DIRECTORIES>)
 
     set_target_properties(${obj_name} PROPERTIES FOLDER "${subproject_title}/Object Libraries")
diff --git a/llvm/cmake/modules/LLVM-Config.cmake b/llvm/cmake/modules/LLVM-Config.cmake
index 7da7e40f3b0fe..96ccf20aa89bd 100644
--- a/llvm/cmake/modules/LLVM-Config.cmake
+++ b/llvm/cmake/modules/LLVM-Config.cmake
@@ -106,10 +106,7 @@ function(explicit_llvm_config executable)
   get_target_property(t ${executable} TYPE)
   if(t STREQUAL "STATIC_LIBRARY")
     target_link_libraries(${executable} INTERFACE ${LIBRARIES})
-  elseif(t STREQUAL "EXECUTABLE" OR
-         t STREQUAL "SHARED_LIBRARY" OR
-         t STREQUAL "MODULE_LIBRARY" OR
-         t STREQUAL "OBJECT_LIBRARY")
+  elseif(t STREQUAL "EXECUTABLE" OR t STREQUAL "SHARED_LIBRARY" OR t STREQUAL "MODULE_LIBRARY")
     target_link_libraries(${executable} PRIVATE ${LIBRARIES})
   else()
     # Use plain form for legacy user.
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 60b73876d53fe..b240aeba23109 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -769,7 +769,7 @@ endfunction(mlir_check_all_link_libraries)
 # used.
 function(mlir_target_link_libraries target type)
   if (TARGET obj.${target})
-    target_link_libraries(obj.${target} ${type} ${ARGN})
+    target_link_libraries(obj.${target} ${ARGN})
   endif()
 
   if (MLIR_LINK_MLIR_DYLIB)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for creating the revert. I'll prepare a new patch which fixes the additional missing callsite from your regression.

@gulfemsavrun
gulfemsavrun enabled auto-merge (squash) March 2, 2026 17:41
@gulfemsavrun
gulfemsavrun merged commit 5ff5a1f into llvm:main Mar 2, 2026
13 of 14 checks passed
@joker-eph

Copy link
Copy Markdown
Contributor

Thanks for reverting, in general in the future though please include the revert reason in the commit message

sahas3 pushed a commit to sahas3/llvm-project that referenced this pull request Mar 4, 2026
…vm#1… (llvm#184186)

…83889)"

This reverts commit 2342db0.

Revert "[CMake] Propagate dependencies to OBJECT libraries in
`add_llvm_library` (llvm#183541)"

This reverts commit e3c0454.
sujianIBM pushed a commit to sujianIBM/llvm-project that referenced this pull request Mar 5, 2026
llvm#184186)

…83889)"

This reverts commit 2342db0.

Revert "[CMake] Propagate dependencies to OBJECT libraries in
`add_llvm_library` (llvm#183541)"

This reverts commit e3c0454.
@gulfemsavrun

Copy link
Copy Markdown
Contributor Author

Thanks for reverting, in general in the future though please include the revert reason in the commit message

I put the revert reason in the PR thread, but I'll make sure the commit description covers it next time as well. Appreciate the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake Build system in general and CMake in particular lld mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants