[PATCH] D157844: [llvm][CMake] Improve error message for unknown or experimental targets
David Spickett via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 17 03:30:00 PDT 2023
DavidSpickett updated this revision to Diff 551073.
DavidSpickett added a comment.
Use the "core tier" name when printing the known targets.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157844/new/
https://reviews.llvm.org/D157844
Files:
llvm/CMakeLists.txt
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -919,15 +919,21 @@
foreach(t ${LLVM_TARGETS_TO_BUILD})
set( td ${LLVM_MAIN_SRC_DIR}/lib/Target/${t} )
- list(FIND LLVM_ALL_TARGETS ${t} idx)
- list(FIND LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ${t} idy)
- # At this point, LLVMBUILDTOOL already checked all the targets passed in
- # LLVM_TARGETS_TO_BUILD and LLVM_EXPERIMENTAL_TARGETS_TO_BUILD, so
- # this test just makes sure that any experimental targets were passed via
+ # Make sure that any experimental targets were passed via
# LLVM_EXPERIMENTAL_TARGETS_TO_BUILD, not LLVM_TARGETS_TO_BUILD.
- if( idx LESS 0 AND idy LESS 0 )
- message(FATAL_ERROR "The target `${t}' is experimental and must be passed "
- "via LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.")
+ # We allow experimental targets that are not in LLVM_ALL_EXPERIMENTAL_TARGETS,
+ # as long as they are passed via LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.
+ if ( NOT ${t} IN_LIST LLVM_ALL_TARGETS AND NOT ${t} IN_LIST LLVM_EXPERIMENTAL_TARGETS_TO_BUILD )
+ if( ${t} IN_LIST LLVM_ALL_EXPERIMENTAL_TARGETS )
+ message(FATAL_ERROR "The target `${t}' is experimental and must be passed "
+ "via LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.")
+ else()
+ message(FATAL_ERROR "The target `${t}' is not a core tier target. It may be "
+ "experimental, if so it must be passed via "
+ "LLVM_EXPERIMENTAL_TARGETS_TO_BUILD.\n"
+ "Core tier targets: ${LLVM_ALL_TARGETS}\n"
+ "Known experimental targets: ${LLVM_ALL_EXPERIMENTAL_TARGETS}")
+ endif()
else()
set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${t})\n")
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157844.551073.patch
Type: text/x-patch
Size: 1742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230817/24e8932c/attachment.bin>
More information about the llvm-commits
mailing list