找到你要的答案

Q:Create a cmake project testing another cmake project

Q:创建一个指定项目的测试一个指定项目

we have a cmake project which does not use automated tests. So I want to create another cmake project including the Boost-test framework to test the other project. I know, it would be perhaps better to add the test project within the other project, but we have to change the project structure for this purpose. So I want a non-invasive test project. Here is the structure of my idea:

   +---Project_A
          |
          CMakeList.txt
          src
          modules
          .
          .
          .
   +---Test_Project
          |
          CMakeList.txt

I tried to use the cmake-include statement in the Test_Project to include Project_A. But CMake tries to compile the Project_A-files within the Test_Project. So how can I tell CMake to compile the files within Project_A? Do you know maybe a better way to test Project_A without changing it's project structure?

我们的项目不使用自动化测试。所以我想创建一个指定项目包括提高测试框架来测试其他项目。我知道,在另一个项目中添加测试项目可能更好,但我们必须为此更改项目结构。所以我想要一个非侵入性的测试项目。以下是我的想法的结构:

   +---Project_A
          |
          CMakeList.txt
          src
          modules
          .
          .
          .
   +---Test_Project
          |
          CMakeList.txt

我试图用cmake包含语句在test_project包括project_a。但cmake编译project_a-files试图在test_project。我怎么能告诉cmake编译文件中的project_a?你知道,也许一个更好的方式来测试project_a没有改变它的项目结构?

c++  testing  cmake