From 9da90fab6716d9f8257a6dd144e386d3893c4355 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 19 May 2020 18:39:24 +0200 Subject: [PATCH] CMake: Use provided OUTPUT_DIRECTORY for manual tests and benchmarks If an OUTPUT_DIRECTORY option is provided, it should be used instead of discarding it. Change-Id: Ie53b56616f16589f7c05ff9378d7ba2e2ba34726 Reviewed-by: Cristian Adam --- cmake/QtBuild.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index eda5d9ff74..0cb8e7e3fb 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -3464,9 +3464,13 @@ function(qt_add_benchmark target) ${ARGV} ) + if(NOT arg_OUTPUT_DIRECTORY) + set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + endif() + qt_add_executable(${target} NO_INSTALL # we don't install benchmarks - OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" # avoid polluting bin directory + OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" # avoid polluting bin directory ${exec_args} ) @@ -3497,9 +3501,13 @@ function(qt_add_manual_test target) ${ARGV} ) + if(NOT arg_OUTPUT_DIRECTORY) + set(arg_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") + endif() + qt_add_executable(${target} NO_INSTALL # we don't install benchmarks - OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" # avoid polluting bin directory + OUTPUT_DIRECTORY "${arg_OUTPUT_DIRECTORY}" # avoid polluting bin directory ${exec_args} )