qt_skip_default_testcase_dirs

该属性在 Qt 6.9 中引入。

注意: 此属性为技术预览版,可能会在未来版本中更改。

该属性禁用目标的以下编译时定义:

  • qt_testcase_sourcedir
  • qt_testcase_builddir

默认情况下,这些定义指向目标的源代码和编译目录。由于这些定义只针对该目标,因此在编译其他目标时不会共享预编译头文件。如果QT_SKIP_DEFAULT_TESTCASE_DIRS 设置为TRUE ,这些定义将被省略,从而避免这一限制。

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

编译mytest 时,QT_TESTCASE_SOURCEDIRQT_TESTCASE_BUILDDIR 宏将保持未定义状态。

该属性的值默认为QT_SKIP_DEFAULT_TESTCASE_DIRS变量的值。

另请参阅 QFINDTESTDATAQT_SKIP_DEFAULT_TESTCASE_DIRS

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.