CMake build: Improve default qmake for dumper tests

We can do better than just "qmake" and instead take the path to
the qmake that the test was compiled with.
(Can still be overridden with environment variables.)

Change-Id: Icc045d4f96946aeb1f324e6f1334dc9747215f3f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2021-05-28 14:14:03 +02:00
parent de2e106475
commit 07b0aa89f5
4 changed files with 9 additions and 2 deletions

View File

@@ -9,10 +9,14 @@ add_qtc_test(tst_debugger_disassembler
option(WITH_DEBUGGER_DUMPERS "Include tests for debugger pretty printers" ON)
if (WITH_DEBUGGER_DUMPERS)
get_target_property(qmake_binary Qt5::qmake IMPORTED_LOCATION)
add_qtc_test(tst_debugger_dumpers
TIMEOUT 0
DEPENDS Qt5::Network Utils
DEFINES DUMPERDIR="${PROJECT_SOURCE_DIR}/share/qtcreator/debugger"
DEFINES
DUMPERDIR="${PROJECT_SOURCE_DIR}/share/qtcreator/debugger"
DEFAULT_QMAKE_BINARY="${qmake_binary}"
INCLUDES
"${DEBUGGERDIR}"
SOURCES

View File

@@ -64,8 +64,10 @@ HEADERS += \
!isEmpty(vcproj) {
DEFINES += DUMPERDIR=\"$$DUMPERDIR\"
DEFINES += DEFAULT_QMAKE_BINARY=\"qmake\"
} else {
DEFINES += DUMPERDIR=\\\"$$DUMPERDIR\\\"
DEFINES += DEFAULT_QMAKE_BINARY=\\\"qmake\\\"
}
INCLUDEPATH += $$DEBUGGERDIR

View File

@@ -26,6 +26,7 @@ QtcAutotest {
cpp.defines: base.concat([
'CDBEXT_PATH="' + project.buildDirectory + '\\\\lib"',
'DUMPERDIR="' + path + '/../../../share/qtcreator/debugger"',
'DEFAULT_QMAKE_BINARY="qmake"'
])
cpp.includePaths: base.concat([project.debuggerDir])
}

View File

@@ -1189,7 +1189,7 @@ void tst_Dumpers::initTestCase()
m_qmakeBinary = QDir::fromNativeSeparators(QString::fromLocal8Bit(qgetenv("QTC_QMAKE_PATH_FOR_TEST")));
if (m_qmakeBinary.isEmpty())
m_qmakeBinary = "qmake";
m_qmakeBinary = DEFAULT_QMAKE_BINARY;
if (qEnvironmentVariableIntValue("QTC_USE_CMAKE_FOR_TEST"))
m_buildSystem = BuildSystem::CMake;