查找XC测试

在 3.3 版本加入.

帮助创建和执行 XCTest 包的功能。

XCTest 包是一个具有特殊产品类型和包扩展的 CFBundle。 Mac 开发人员库在“使用 Xcode 进行测试”文档中提供了更多信息。

模块功能

xctest_add_bundle

xctest_add_bundle 函数创建一个名为 <target> 的 XCTest 包,它将测试目标 <testee>。受测者支持的目标类型是框架和应用程序包

xctest_add_bundle(
  <target>  # Name of the XCTest bundle
  <testee>  # Target name of the testee
  )
xctest_add_test

xctest_add_test 函数将 XCTest 包添加到要由 ctest(1) 运行的项目中。测试将被命名为 <name> 并测试 <bundle>:

xctest_add_test(
  <name>    # Test name
  <bundle>  # Target name of XCTest bundle
  )

模块变量

通过包含此模块设置以下变量:

XCTest_FOUND

如果找到 XCTest 框架和可执行文件,则为真。

XCTest_EXECUTABLE

用于执行 XCTest 包的 xctest 命令行工具的路径。

XCTest_INCLUDE_DIRS

包含 XCTest 框架标头的目录。

XCTest_LIBRARIES

XCTest 框架的位置。