- Qt 6.9
- Qt Test
- CMake Target Properties in Qt6 Test
- QT_SKIP_DEFAULT_TESTCASE_DIRS
- Qt 6.9.3 Reference Documentation

# QT_SKIP_DEFAULT_TESTCASE_DIRS

This property was introduced in Qt 6.9.

Note: This property is in technology preview and may change in future releases.

The property disables the following compile-time definitions for the target:

- QT_TESTCASE_SOURCEDIR
- QT_TESTCASE_BUILDDIR

By default, these definitions point to the source and build directories of the target. Since they are only defined for this target, they preclude sharing precompiled headers with the compilation of other targets. If `QT_SKIP_DEFAULT_TESTCASE_DIRS` is set to `TRUE` these definitions are omitted, avoiding this limitation.

     qt_add_executable(mytest main.cpp)
     set_property(TARGET mytest PROPERTY QT_SKIP_DEFAULT_TESTCASE_DIRS TRUE)
     target_link_libraries(mytest PRIVATE Qt6::Test)

The `QT_TESTCASE_SOURCEDIR` and `QT_TESTCASE_BUILDDIR` macros will remain undefined when compiling `mytest`.

The value of the property defaults to the value of the QT_SKIP_DEFAULT_TESTCASE_DIRS variable.

See also QFINDTESTDATA and QT_SKIP_DEFAULT_TESTCASE_DIRS.