CMake: Handle slashes in qt_internal_add_example
qtdeclarative has a call like qt_internal_add_example(imagine/automotive) This causes issues when trying to pass that as the name of the external project. Use the last part after the last slash as the name of the project. Pick-to: 6.2 6.3 Change-Id: Ifc074e50e537f07f3636699ed255d2561930d873 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
2536d73adc
commit
92dff7c5f8
@ -922,6 +922,19 @@ function(qt_internal_add_example_external_project subdir)
|
||||
|
||||
if(NOT arg_NAME)
|
||||
set(arg_NAME "${subdir}")
|
||||
|
||||
# qtdeclarative has calls like qt_internal_add_example(imagine/automotive)
|
||||
# so passing a nested subdirectory. Custom targets (and thus ExternalProjects) can't contain
|
||||
# slashes, so extract the last part of the path to be used as a name.
|
||||
if(arg_NAME MATCHES "/")
|
||||
string(REPLACE "/" ";" exploded_path "${arg_NAME}")
|
||||
list(POP_BACK exploded_path last_dir)
|
||||
if(NOT last_dir)
|
||||
message(FATAL_ERROR "Example subdirectory must have a name.")
|
||||
else()
|
||||
set(arg_NAME "${last_dir}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Likely a clash with an example subdir ExternalProject custom target of the same name.
|
||||
|
Loading…
x
Reference in New Issue
Block a user