我必须首次在Windows上使用googletest与CLion,我尝试按照一些指南,也来自CLion的官方网站,但我无法在我的项目上运行googletest。 My files are organised like in this image,带蓝色下划线的CMakeLists.txt包含:
cmake_minimum_required(VERSION 3.6)
project(provaQT)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set (CMAKE_PREFIX_PATH "/Qt/5.7/mingw53_32/lib/cmake/Qt5Widgets")
set(CMAKE_AUTOMOC ON)
add_subdirectory(tests)
find_package(Qt5Widgets REQUIRED)
set(SOURCE_FILES main.cpp Subject.h Observer.h Resource.cpp Resource.h
MainWindow.cpp MainWindow.h tests/ResourceTests.cpp)
add_executable(provaQT main.cpp)
add_library(core ${SOURCE_FILES})
target_link_libraries(core Qt5::Widgets)
target_link_libraries(provaQT core)
文件夹中的其他CMakeLists.txt"测试"包含:
cmake_minimum_required(VERSION 3.6)
add_subdirectory(./lib/googletest)
set(gtest_SOURCE_DIR ./lib/googletest/)
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
set(TEST_SOURCE_FILES runAllTests.cpp Resourcetests.cpp)
add_executable(runAllTests ${TEST_SOURCE_FILES})
target_link_libraries(runAllTests gtest gtest_main core)
我在ResourceTests.cpp文件中编写了一个测试,当我构建Google Test配置时,我得到these errors。
什么是不明白?