diff options
author | Michael Kruse <llvm-project@meinersbur.de> | 2020-01-07 11:41:14 -0600 |
---|---|---|
committer | Michael Kruse <llvm-project@meinersbur.de> | 2020-01-07 20:42:35 +0100 |
commit | b6503901f24efb12f1fa700cbb67935e78f6bd09 (patch) | |
tree | f41f12ca492df7f81745d34e25230bed5c79ab4a /llvm/cmake/modules | |
parent | 8edf759ca7e1ceadb8bd4c0701f08c48850c26e7 (diff) | |
download | bcm5719-llvm-b6503901f24efb12f1fa700cbb67935e78f6bd09.tar.gz bcm5719-llvm-b6503901f24efb12f1fa700cbb67935e78f6bd09.zip |
[cmake] Use relative cmake binary dir for processing pass plugins.
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 LLVM_BINARY_DIR to get the right relative
directory for cmake.
Patch by Alan Baker <alanbaker@google.com>
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D72109
Diffstat (limited to 'llvm/cmake/modules')
-rw-r--r-- | llvm/cmake/modules/AddLLVM.cmake | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index c1bbae78878..75e0f10d68a 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -883,7 +883,7 @@ endfunction(add_llvm_pass_plugin) # 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 "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" "//extension handlers\n") foreach(llvm_extension ${LLVM_EXTENSIONS}) string(TOLOWER ${llvm_extension} llvm_extension_lower) @@ -893,23 +893,25 @@ function(process_llvm_pass_plugins) 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 "${LLVM_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 + "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp" + "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def") + file(REMOVE "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def.tmp") endfunction() function(export_executable_symbols target) |