summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2021-03-17 16:15:30 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-17 17:54:16 +0000
commit51dde4b5cb4fe790f78cea30b14d951ab7eae969 (patch)
treeff69c6cd9cc6db75cfae9f58d1fd59c9649dd4df /cmake
parent049e14870c13235cd066758f29c42dc96c1ccdf8 (diff)
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. Change-Id: I8e480c9e72b47783c0910428187f0092049e89db Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 1d6a35c5363944ce59eba114f827b1992f31bde3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtTestHelpers.cmake6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index 06678a741f..0f93dbf5a1 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -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