summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuildInternals
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/QtBuildInternals')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index e37a018bb1..952dc3d3ee 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -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.