cmake测试不编译

时间:2018-03-06 15:56:30

标签: c++ unit-testing cmake

我尝试在项目目录中运行测试。我的CMakeLists.txt是

cmake_minimum_required (VERSION 2.6)
project (fleetd-test-retranslator)

find_path ( ../
            ../../cashes
)
include_directories( ../ 
../../cashes
../../protocols
)
add_executable (fleetd-test-retranslator test_retranslator.cpp)

enable_testing()
find_package(GTest REQUIRED)
if (NOT GTest_FOUND)
    message(FATAL_ERROR "Cannot find Google Test Framework!")
endif()
target_link_libraries(fleetd-test-retranslator GTest::GTest GTest::Main)

set (sources
     test_retranslator.cpp
     ../retranslator.cpp
     ../retranslator.h
     ../slcache.cpp
     )

set(libs
    utils
    core
    cashes
    gtest
    gmock
)

但在我尝试编译此测试后,我收到错误

/home/yrusinov/projects/fleetd-2/cashes/StateCache.h:10: error protocols/Protocol.h: No such file or directory
 #include "protocols/Protocol.h"
                                ^

尽管包含目录且存在文件?我的错误在哪里?

1 个答案:

答案 0 :(得分:0)

非常感谢,我设置了include_directories(../ ../../)和所有编译。