這是我的測試夾具:https://github.com/patrykbajos/ZinotEngine/blob/master/src/tests/core/MapResMgrTest.cpp。 我的CMake文件爲這個可執行文件:https://github.com/patrykbajos/ZinotEngine/blob/master/ZinotEngine.cmake和CMakeLists爲所有可執行文件https://github.com/patrykbajos/ZinotEngine/blob/master/CMakeLists.txt。我在Ubuntu上通過apt-get軟件包libgtest-dev的源代碼編譯了gtest。接下來,我將* .so文件複製到/ usr/lib並安裝libgtest-dev packege,因爲包含文件。我認爲我的測試夾具是正確的。沒有編譯錯誤。我EXEC運行的通常和顯示:GoogleTest測試不啓動
/home/patryk/ClionProjects/BennuEngine/bin/Debug/ZinotEngine
[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (0 ms total)
[ PASSED ] 0 tests.
Hello world!!!
Process finished with exit code 0
我已經添加了一些線向CMake文件,但我認爲它不添加含*測試,以建立可執行的.cpp文件。以下是這些行:
# Sources
file(GLOB_RECURSE ZINOTENGINE_SRC "src/zinot/core/*.c" "src/zinot/core/*.cpp")
file(GLOB_RECURSE ZINOTENGINETESTS_SRC "src/tests/*.cpp")
if (CMAKE_BUILD_TYPE EQUAL "Debug")
message("Debug << dodawanie testów.")
set(ZINOTENGINE_SRC "${ZINOTENGINE_SRC} ${ZINOTENGINETESTS_SRC}")
endif()
# Binary
add_executable(ZinotEngine ${ZINOTENGINE_SRC})
這是我的整個代碼庫:https://github.com/patrykbajos/ZinotEngine。
PS。我正在編譯我的項目,由CLion在Build All
上Configuration: Debug
。