[PATCH] [cmake] Unbreak LLVM-Config.cmake / llvm_expand_dependencies

Peter Zotov whitequark at whitequark.org
Mon Dec 1 12:45:26 PST 2014


================
Comment at: cmake/modules/LLVM-Config.cmake:155
@@ -154,1 +154,3 @@
 
+function(expand_topologically name required_libs visited_libs)
+  list(FIND visited_libs ${name} found)
----------------
rnk wrote:
> Can you add a comment before the function describing what it does, and perhaps reference the llvm-config code? It's doing a post-order traversal, which is apparently not what the linker expects.
> 
> Would a pre-order traversal save the list reversal? It's not immediately clear to me that it would.
It just duplicates the algorithm in the llvm-config binary to keep things simple. Also IIRC I started with a pre-order traversal and it looked really ugly when implemented in cmake.

================
Comment at: cmake/modules/LLVM-Config.cmake:183
@@ +182,3 @@
+
+  list(REVERSE required_libs)
+  set(${out_libs} ${required_libs} PARENT_SCOPE)
----------------
rnk wrote:
> I guess the linker actually expects roots first and leaves last.
What do you mean? llvm_expand_dependencies currently uses the correct ordering; it won't build without this REVERSE.

http://reviews.llvm.org/D6099






More information about the llvm-commits mailing list