diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-06-25 20:45:55 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-06-26 21:24:50 +0200 |
commit | af61b5ca5cd92dbf21ee42e0a74f618b3b578ddd (patch) | |
tree | a237ae218abff4bb852d0c18841d78c26176c38e /tests | |
parent | b40f36603d93294d3117849acdd5ca6f012cd9f9 (diff) |
CMake: Fix tst_qmake::resources() on Windows
This test calls qmake on a project that generates a .qrc file. On
Windows, where debug_and_release is on by default, the generated qrc
file ends up in a "debug" or "release" subdirectory. On other
platforms the file is generated directly in the build dir.
To guess the right location, the preprocessor defines RELEASE_BUILD
and DEBUG_BUILD were passed to tst_qmake.cpp by the test's .pro file.
While the mapping from debug_and_release was fine for the .pro file,
it was commented out in the automatically converted CMakeLists.txt.
Instead of trying to fix the condition, we're going the easier route
that's used in all other .pro files of tst_qmake: make sure that
debug_and_release doesn't get in the way. In other tests this is done
by setting
DESTDIR = ./
which doesn't work for the generated qrc file. That's why we simply do
CONFIG -= debug_and_release
to make sure that everything is generated directly in the build dir.
Change-Id: I557ac4e21d7b385004d369fae8a3f727d76d4d88
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/tools/qmake/CMakeLists.txt | 13 | ||||
-rw-r--r-- | tests/auto/tools/qmake/qmake.pro | 6 | ||||
-rw-r--r-- | tests/auto/tools/qmake/testdata/resources/resources.pro | 1 | ||||
-rw-r--r-- | tests/auto/tools/qmake/tst_qmake.cpp | 14 |
4 files changed, 4 insertions, 30 deletions
diff --git a/tests/auto/tools/qmake/CMakeLists.txt b/tests/auto/tools/qmake/CMakeLists.txt index 994d5d47d1..62db9257b8 100644 --- a/tests/auto/tools/qmake/CMakeLists.txt +++ b/tests/auto/tools/qmake/CMakeLists.txt @@ -27,16 +27,3 @@ extend_target(tst_qmake CONDITION CMAKE_CROSSCOMPILING DEFINES QMAKE_CROSS_COMPILED ) - -# special case begin -# remove this because it's not needed -#extend_target(tst_qmake CONDITION CMAKE_BUILD_TYPE STREQUAL Debug AND debug_and_release - #DEFINES - #DEBUG_BUILD -#) - -#extend_target(tst_qmake CONDITION debug_and_release AND NOT CMAKE_BUILD_TYPE STREQUAL Debug - #DEFINES - #RELEASE_BUILD -#) -# special case end diff --git a/tests/auto/tools/qmake/qmake.pro b/tests/auto/tools/qmake/qmake.pro index ac52fb81fa..0e8ebcc7cc 100644 --- a/tests/auto/tools/qmake/qmake.pro +++ b/tests/auto/tools/qmake/qmake.pro @@ -7,11 +7,5 @@ SOURCES += tst_qmake.cpp testcompiler.cpp QT = core testlib cross_compile: DEFINES += QMAKE_CROSS_COMPILED -debug_and_release { - CONFIG(debug, debug|release): \ - DEFINES += DEBUG_BUILD - else: \ - DEFINES += RELEASE_BUILD -} TESTDATA += testdata/* diff --git a/tests/auto/tools/qmake/testdata/resources/resources.pro b/tests/auto/tools/qmake/testdata/resources/resources.pro index f024fe5617..8ced5048ae 100644 --- a/tests/auto/tools/qmake/testdata/resources/resources.pro +++ b/tests/auto/tools/qmake/testdata/resources/resources.pro @@ -1,4 +1,5 @@ TEMPLATE = app +CONFIG -= debug_and_release SOURCES = main.cpp pro_file.files = resources.pro diff --git a/tests/auto/tools/qmake/tst_qmake.cpp b/tests/auto/tools/qmake/tst_qmake.cpp index 7f98a0f5a0..2b9ecddf2b 100644 --- a/tests/auto/tools/qmake/tst_qmake.cpp +++ b/tests/auto/tools/qmake/tst_qmake.cpp @@ -37,14 +37,6 @@ #include <QStandardPaths> #include <QTemporaryDir> -#if defined(DEBUG_BUILD) -# define DIR_INFIX "debug/" -#elif defined(RELEASE_BUILD) -# define DIR_INFIX "release/" -#else -# define DIR_INFIX "" -#endif - class tst_qmake : public QObject { Q_OBJECT @@ -725,7 +717,7 @@ void tst_qmake::resources() QVERIFY(test_compiler.qmake(workDir, "resources")); { - QFile qrcFile(workDir + '/' + DIR_INFIX "qmake_pro_file.qrc"); + QFile qrcFile(workDir + '/' + "qmake_pro_file.qrc"); QVERIFY2(qrcFile.exists(), qPrintable(qrcFile.fileName())); QVERIFY(qrcFile.open(QFile::ReadOnly)); QByteArray qrcXml = qrcFile.readAll(); @@ -734,7 +726,7 @@ void tst_qmake::resources() } { - QFile qrcFile(workDir + '/' + DIR_INFIX "qmake_subdir.qrc"); + QFile qrcFile(workDir + '/' + "qmake_subdir.qrc"); QVERIFY(qrcFile.exists()); QVERIFY(qrcFile.open(QFile::ReadOnly)); QByteArray qrcXml = qrcFile.readAll(); @@ -742,7 +734,7 @@ void tst_qmake::resources() } { - QFile qrcFile(workDir + '/' + DIR_INFIX "qmake_qmake_immediate.qrc"); + QFile qrcFile(workDir + '/' + "qmake_qmake_immediate.qrc"); QVERIFY(qrcFile.exists()); QVERIFY(qrcFile.open(QFile::ReadOnly)); QByteArray qrcXml = qrcFile.readAll(); |