forked from qt-creator/qt-creator
CMake build: Fix extend_qtc_test
extend_qtc_test should gracefully do nothing if the test was declared, but disabled for any reason. add_qtc_test failed to add the test to the list of declared tests, if dependencies were missing, so extend_qtc_test was complaining that the test didn't exist in that case. add_qtc_test must always add the test to the list of declared tests, and extend_qtc_test must only fail if the test was never declared, but do nothing if the test target does not exist (because the test was disabled for some reason). Change-Id: I414a169e3e23c3c0e11c11e2ee86effa706b545c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -588,7 +588,9 @@ function(extend_qtc_test target_name)
|
||||
if (NOT (target_name IN_LIST __QTC_TESTS))
|
||||
message(FATAL_ERROR "extend_qtc_test: Unknown test target \"${target_name}\"")
|
||||
endif()
|
||||
if (TARGET ${target_name})
|
||||
extend_qtc_target(${target_name} ${ARGN})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(add_qtc_executable name)
|
||||
@@ -782,6 +784,12 @@ endfunction()
|
||||
function(add_qtc_test name)
|
||||
cmake_parse_arguments(_arg "GTEST" "TIMEOUT" "DEFINES;DEPENDS;INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC" ${ARGN})
|
||||
|
||||
if ($_arg_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "add_qtc_test had unparsed arguments!")
|
||||
endif()
|
||||
|
||||
update_cached_list(__QTC_TESTS "${name}")
|
||||
|
||||
foreach(dependency ${_arg_DEPENDS})
|
||||
if (NOT TARGET ${dependency} AND NOT _arg_GTEST)
|
||||
if (WITH_DEBUG_CMAKE)
|
||||
@@ -791,12 +799,6 @@ function(add_qtc_test name)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if ($_arg_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "add_qtc_test had unparsed arguments!")
|
||||
endif()
|
||||
|
||||
update_cached_list(__QTC_TESTS "${name}")
|
||||
|
||||
set(TEST_DEFINES SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
# relax cast requirements for tests
|
||||
|
Reference in New Issue
Block a user