[PATCH] D72109: [cmake] Use relative cmake binary dir for processing pass plugins
Alan Baker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 14:00:21 PST 2020
alan-baker created this revision.
alan-baker added a reviewer: serge-sans-paille.
alan-baker added a project: LLVM.
Herald added subscribers: llvm-commits, mgorny.
alan-baker added a reviewer: Meinersbur.
https://reviews.llvm.org/D61446 introduced a new function to process pass plugins that used CMAKE_BINARY_DIR. This is problematic when LLVM is a subproject. Instead use CMAKE_CURRENT_BINARY_DIR to get the right relative directory for cmake.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72109
Files:
llvm/cmake/modules/AddLLVM.cmake
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -878,7 +878,7 @@
# Also correctly set lib dependencies between plugins and tools.
function(process_llvm_pass_plugins)
get_property(LLVM_EXTENSIONS GLOBAL PROPERTY LLVM_COMPILE_EXTENSIONS)
- file(WRITE "${CMAKE_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "//extension handlers\n")
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "//extension handlers\n")
foreach(llvm_extension ${LLVM_EXTENSIONS})
string(TOLOWER ${llvm_extension} llvm_extension_lower)
@@ -888,23 +888,25 @@
string(CONCAT llvm_extension_project ${llvm_extension_upper_first} ${llvm_extension_lower_tail})
if(LLVM_${llvm_extension_upper}_LINK_INTO_TOOLS)
- file(APPEND "${CMAKE_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "HANDLE_EXTENSION(${llvm_extension_project})\n")
+ file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "HANDLE_EXTENSION(${llvm_extension_project})\n")
- get_property(llvm_plugin_targets GLOBAL PROPERTY LLVM_PLUGIN_TARGETS)
- foreach(llvm_plugin_target ${llvm_plugin_targets})
- set_property(TARGET ${llvm_plugin_target} APPEND PROPERTY LINK_LIBRARIES ${llvm_extension})
- set_property(TARGET ${llvm_plugin_target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${llvm_extension})
- endforeach()
+ get_property(llvm_plugin_targets GLOBAL PROPERTY LLVM_PLUGIN_TARGETS)
+ foreach(llvm_plugin_target ${llvm_plugin_targets})
+ set_property(TARGET ${llvm_plugin_target} APPEND PROPERTY LINK_LIBRARIES ${llvm_extension})
+ set_property(TARGET ${llvm_plugin_target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${llvm_extension})
+ endforeach()
else()
add_llvm_library(${llvm_extension_lower} MODULE obj.${llvm_extension_lower})
endif()
endforeach()
- file(APPEND "${CMAKE_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "#undef HANDLE_EXTENSION\n")
+ file(APPEND "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "#undef HANDLE_EXTENSION\n")
# only replace if there's an actual change
- execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "${CMAKE_BINARY_DIR}/include/llvm/Support/Extension.def")
- file(REMOVE "${CMAKE_BINARY_DIR}/include/llvm/Support/Extension.def.tmp")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${CMAKE_CURRENT_BINARY_DIR}/include/llvm/Support/Extension.def.tmp"
+ "${CMAKE_CURRENT_BINARY_DIR}/include/llvm/Support/Extension.def")
+ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/include/llvm/Support/Extension.def.tmp")
endfunction()
function(export_executable_symbols target)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72109.235943.patch
Type: text/x-patch
Size: 2891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200102/837ab008/attachment.bin>
More information about the llvm-commits
mailing list