[PATCH] D77106: [cmake] Only set deps for an ExternalProject if the type is executable or library
Nathan Lanza via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 30 17:30:22 PDT 2020
lanza created this revision.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.
cmake fails with an error when attempting to evaluate $<TARGET_FILE:tgt>
where `tgt` is defined via an `add_custom_target` and thus the `TYPE`
is `UTILITY`. Requesting a TARGET_FILE only works on an `EXECUTABLE`
or `LIBRARY` type (e.g. added via `add_library` or `add_executable`).
This has always been the case back to at least 3.12 (furthest I checked)
but this is causing a new failure in cmake 3.17 while evaluating
ExternalProjectAdd.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77106
Files:
llvm/cmake/modules/LLVMExternalProjectUtils.cmake
Index: llvm/cmake/modules/LLVMExternalProjectUtils.cmake
===================================================================
--- llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -62,7 +62,13 @@
foreach(tool ${ARG_TOOLCHAIN_TOOLS})
if(TARGET ${tool})
list(APPEND TOOLCHAIN_TOOLS ${tool})
- list(APPEND TOOLCHAIN_BINS $<TARGET_FILE:${tool}>)
+
+ # $<TARGET_FILE:tgt> only works on add_executable or add_library targets
+ get_target_property(target_type "${tool}" TYPE)
+ if (target_type STREQUAL "EXECUTABLE" OR target_type SREQUAL "LIBRARY")
+ list(APPEND TOOLCHAIN_BINS $<TARGET_FILE:${tool}>)
+ endif()
+
endif()
endforeach()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77106.253745.patch
Type: text/x-patch
Size: 742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200331/b251d0c4/attachment-0001.bin>
More information about the llvm-commits
mailing list