Skip to content

Commit d9463ed

Browse files
authored
[ATfE] Throw an error if a requested variant name is not found (#457) (#465)
By default the toolchain enables all available library variants to be built, but a list of specific variants can instead be enabled through the `-DLLVM_TOOLCHAIN_LIBRARY_VARIANTS` option. Currently, if an invalid name is specified, the configuration will not notice and that variant will silently not be built. This patch instead causes the script to throw an error, so that it is clear that an expected variant is missing if the name is incorrect. (cherry picked from commit 2bce241)
1 parent 43522cc commit d9463ed

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arm-software/embedded/arm-multilib/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ foreach(lib_idx RANGE ${lib_count_dec})
173173
endif()
174174

175175
if(variant IN_LIST ENABLE_VARIANTS OR ENABLE_VARIANTS STREQUAL "all")
176+
list(APPEND enabled_variants ${variant})
176177
string(JSON variant_multilib_flags GET ${lib_def} "flags")
177178
# Placeholder libraries won't have a json, so store the error in
178179
# a variable so a fatal error isn't generated.
@@ -364,6 +365,16 @@ foreach(lib_idx RANGE ${lib_count_dec})
364365

365366
endforeach()
366367

368+
# Check that all variants that were configured to be enabled
369+
# were actually enabled.
370+
if(NOT ENABLE_VARIANTS STREQUAL "all")
371+
foreach(expected_variant ${ENABLE_VARIANTS})
372+
if(NOT expected_variant IN_LIST enabled_variants)
373+
message(FATAL_ERROR "Variant name ${expected_variant} not found in ${MULTILIB_JSON}")
374+
endif()
375+
endforeach()
376+
endif()
377+
367378
# Multilib file is generated in two parts.
368379
# 1. Template is filled with multilib flags from json
369380
configure_file(

0 commit comments

Comments
 (0)