######################################## CTest ######################################## 假设现在有一个路径如下 :: . ├── CMakeLists.txt ├── src │   └── CMakeLists.txt └── test ├── CMakeLists.txt └── main.cpp 则使用 CTest 的方式为: #. 在 CMakeLists.txt 中引入 CTest .. code-block:: cmake include(CTest) #. 在 test/CMakeLists 中写入: .. code-block:: cmake add_executable(someTest main.cpp) add_test(TestLayout someTest) 之后使用的方式为: .. code-block:: none cmake --build build cd build && ctest