qt5base-lts/tests/auto/tools/qmake/CMakeLists.txt
Joerg Bornemann af61b5ca5c 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>
2020-06-26 21:24:50 +02:00

30 lines
724 B
CMake

# Generated from qmake.pro.
#####################################################################
## tst_qmake Test:
#####################################################################
# Collect test data
file(GLOB_RECURSE test_data_glob
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
testdata/*)
list(APPEND test_data ${test_data_glob})
add_qt_test(tst_qmake
SOURCES
testcompiler.cpp testcompiler.h
tst_qmake.cpp
TESTDATA ${test_data}
)
## Scopes:
#####################################################################
#### Keys ignored in scope 2:.:.:qmake.pro:WIN32:
# testcase.timeout = "900"
extend_target(tst_qmake CONDITION CMAKE_CROSSCOMPILING
DEFINES
QMAKE_CROSS_COMPILED
)