Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-92079

QFINDTESTDATA does not find data relative to test source

    XMLWordPrintable

Details

    • All
    • 70464b355ec1c7007e0b1291f733e2540ba1825f (qt/qtbase/dev)

    Description

      With a test in {srcdir}/autotests and a data file in {srcdir}/autotests/data/testfile QFINDTESTDATA("data/testfile") fails to find the file with Qt6 but works fine in Qt 5.15.

      The issue boils down to the fact that QT_TESTCASE_BUILDDIR is not defined when building against Qt6.

      In Qt5 the following code would have it defined:

       

      find_package(Qt5 REQUIRED COMPONENTS Core Test)add_executable(foo main.cpp)
      target_link_libraries(foo PRIVATE Qt::Core Qt::Test)
      

      This is done in Qt5TestConfigExtras.cmake

      However this is not the case when building against Qt6. There QT_TESTCASE_BUILDDIR is only defined in QtTestHelpers.cmake which does not seem to be public

       

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-92079
          # Subject Branch Project Status CR V

          Activity

            People

              semlanik Alexey Edelev
              nicolasfella Nicolas Fella
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes