CMake: Don't attempt to add to a target that doesn't exist

When configuring a benchmark using the standalone-test script the
'benchmark' target is not available, causing a configure error.

Pick-to: 6.1 6.0
Change-Id: I8e480c9e72b47783c0910428187f0092049e89db
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Mårten Nordheim 2021-03-17 16:15:30 +01:00
parent fac23d695f
commit 1d6a35c536

View File

@ -51,8 +51,10 @@ function(qt_internal_add_benchmark target)
add_dependencies("${target}_benchmark" "${target}")
#Add benchmark to meta target.
add_dependencies("benchmark" "${target}_benchmark")
# Add benchmark to meta target if it exists.
if (TARGET benchmark)
add_dependencies("benchmark" "${target}_benchmark")
endif()
endfunction()
# Simple wrapper around qt_internal_add_executable for manual tests which insure that