Skip to content

Commit be09b2f

Browse files
committed
[cmake] Remove direct computation of dependencies on LLVM libraries and exact paths to those libraries.
Now that we have the full dependency information from LLVM/Clang, this is no longer necessary. We will just do the *right* thing. Additionally, since we were passing these libraries as absolute paths, cmake was always passing through all of the given libraries even if CMake had already added them to the link line in its non-absolute form. It is not clear to me how if all linkers would be smart about this. Regardless, now we just translate components to libraries and continue on our merry way. In the future, we can even remove the llvm-build code period by just specifying LLVM dependencies directly via LINK_LIBRARIES instead of having to do anything with COMPONENT_DEPENDS. But that is for a future commit.
1 parent a0480e5 commit be09b2f

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -376,32 +376,6 @@ function(swift_common_llvm_config target)
376376
if((SWIFT_BUILT_STANDALONE OR SOURCEKIT_BUILT_STANDALONE) AND NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
377377
llvm_map_components_to_libnames(libnames ${link_components})
378378

379-
# Collect dependencies.
380-
set(new_libnames)
381-
foreach(lib ${libnames})
382-
list(APPEND new_libnames "${lib}")
383-
get_target_property(extra_libraries "${lib}" INTERFACE_LINK_LIBRARIES)
384-
foreach(dep ${extra_libraries})
385-
if(NOT "${new_libnames}" STREQUAL "")
386-
list(REMOVE_ITEM new_libnames "${dep}")
387-
endif()
388-
list(APPEND new_libnames "${dep}")
389-
endforeach()
390-
endforeach()
391-
set(libnames "${new_libnames}")
392-
393-
# Translate library names into full path names.
394-
set(new_libnames)
395-
foreach(dep ${libnames})
396-
if("${dep}" MATCHES "^LLVM")
397-
list(APPEND new_libnames
398-
"${LLVM_LIBRARY_OUTPUT_INTDIR}/lib${dep}.a")
399-
else()
400-
list(APPEND new_libnames "${dep}")
401-
endif()
402-
endforeach()
403-
set(libnames "${new_libnames}")
404-
405379
get_target_property(target_type "${target}" TYPE)
406380
if("${target_type}" STREQUAL "STATIC_LIBRARY")
407381
target_link_libraries("${target}" INTERFACE ${libnames})

0 commit comments

Comments
 (0)