From 914fe4855f5cd14200c37a76b68a9148ad9ba6b0 Mon Sep 17 00:00:00 2001 From: Alexander Kutsan Date: Sun, 8 Dec 2019 20:02:46 +0300 Subject: [PATCH] Dummy cmake project with google tests --- .gitignore | 3 +++ .gitmodules | 3 +++ CMakeLists.txt | 14 ++++++++++++++ cmake | 1 + main.cc | 5 +++++ project.cc | 5 +++++ project.h | 3 +++ test/CMakeLists.txt | 7 +++++++ test/project_test.cc | 0 9 files changed, 41 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 160000 cmake create mode 100644 main.cc create mode 100644 project.cc create mode 100644 project.h create mode 100755 test/CMakeLists.txt create mode 100644 test/project_test.cc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e3814ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build +CMakeLists.txt.user* + diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..dd6cc15 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cmake"] + path = cmake + url = https://github.com/CLIUtils/cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..fa050f2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.7) +project(dummy_cmake_project) + +set(CMAKE_CXX_STANDARD 14) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +set(SOURCES project.cc) +add_library(ProjectLib ${SOURCES}) + +add_executable(project main.cc) +target_link_libraries(project ProjectLib) + +enable_testing() +add_subdirectory(test) diff --git a/cmake b/cmake new file mode 160000 index 0000000..7fe259a --- /dev/null +++ b/cmake @@ -0,0 +1 @@ +Subproject commit 7fe259ab9d833048971e8ef0cac99672950986db diff --git a/main.cc b/main.cc new file mode 100644 index 0000000..5b2357f --- /dev/null +++ b/main.cc @@ -0,0 +1,5 @@ +#include "project.h" + +int main() { + return 0; +} diff --git a/project.cc b/project.cc new file mode 100644 index 0000000..eb32d55 --- /dev/null +++ b/project.cc @@ -0,0 +1,5 @@ +#include "project.h" + +int sum(int x, int y) { + return x + y; +} diff --git a/project.h b/project.h new file mode 100644 index 0000000..f024477 --- /dev/null +++ b/project.h @@ -0,0 +1,3 @@ +#pragma once + +int sum(); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100755 index 0000000..8d6190d --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,7 @@ +include_directories (${CMAKE_SOURCE_DIR}) + +include(AddGoogleTest) + +add_executable (ProjectTest project_test.cc) +add_gtest(ProjectTest) +target_link_libraries(ProjectTest PUBLIC ProjectLib) diff --git a/test/project_test.cc b/test/project_test.cc new file mode 100644 index 0000000..e69de29