Add cmake warning if multiple SOURCES w/o PREFIX (#3916) (#3927)

This commit is contained in:
Yoda Lee 2023-02-03 11:08:13 +08:00 committed by GitHub
parent d2aff13402
commit 80b291407b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,6 +142,10 @@ function(verilate TARGET)
endif()
if (NOT VERILATE_PREFIX)
list(LENGTH VERILATE_SOURCES NUM_SOURCES)
if (${NUM_SOURCES} GREATER 1)
message(WARNING "Specify PREFIX if there are multiple SOURCES")
endif()
list(GET VERILATE_SOURCES 0 TOPSRC)
get_filename_component(_SRC_NAME ${TOPSRC} NAME_WE)
set(VERILATE_PREFIX V${_SRC_NAME})