CMake: add lib skeleton and google-tests
This commit is contained in:
19
google-tests/CMakeLists.txt
Normal file
19
google-tests/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
project(Google_Tests)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
# 'lib' is the folder with Google Test sources
|
||||
add_subdirectory(lib)
|
||||
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
|
||||
|
||||
# 'Google_Tests_run' is the target name
|
||||
# 'test1.cpp test2.cpp' are source files with tests
|
||||
add_executable(Google_Tests_run test1.cpp)
|
||||
|
||||
target_link_libraries(Google_Tests_run pasada)
|
||||
#target_include_directories(Google_Tests_run PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/pasada-lib/include")
|
||||
|
||||
target_link_libraries(Google_Tests_run gtest gtest_main)
|
||||
#target_link_libraries(Google_Tests_run PRIVATE Pasada_Lib)
|
||||
|
||||
target_include_directories(Google_Tests_run PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../pasada-lib/include")
|
||||
15
google-tests/test1.cpp
Normal file
15
google-tests/test1.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by david on 28.02.2026.
|
||||
//
|
||||
#include <gtest/gtest.h>
|
||||
#include "library.h"
|
||||
|
||||
// Demonstrate some basic assertions.
|
||||
TEST(HelloTest, BasicAssertions) {
|
||||
// Expect two strings not to be equal.
|
||||
EXPECT_STRNE("hello", "world from test1.cpp");
|
||||
// Expect equality.
|
||||
EXPECT_EQ(7 * 6, 42);
|
||||
printf("asdf");
|
||||
hello();
|
||||
}
|
||||
Reference in New Issue
Block a user