From 55505b628856e61493dc4c2c48dc8bc052af7304 Mon Sep 17 00:00:00 2001 From: York Jasper Niebuhr Date: Fri, 3 Oct 2025 21:10:34 +0200 Subject: [PATCH] CMake setup --- .gitignore | 1 + CMakeLists.txt | 15 +++++++++++++++ include/metadump.hpp | 5 +++++ test/CMakeLists.txt | 2 ++ test/simple.cpp | 11 +++++++++++ 5 files changed, 34 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 include/metadump.hpp create mode 100644 test/CMakeLists.txt create mode 100644 test/simple.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f6fef81 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.28) +project(Metadump LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_library(metadump INTERFACE) +target_include_directories(metadump INTERFACE include) + +# Building the tests is optional +option(METADUMP_BUILD_TESTS "Build metadump tests" OFF) +if (METADUMP_BUILD_TESTS OR (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)) + find_package(GTest REQUIRED) + add_subdirectory(test) +endif() diff --git a/include/metadump.hpp b/include/metadump.hpp new file mode 100644 index 0000000..26694bd --- /dev/null +++ b/include/metadump.hpp @@ -0,0 +1,5 @@ +#pragma once + +namespace metadump { + +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..4294db6 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(metadump_test_simple simple.cpp) +target_link_libraries(metadump_test_simple PRIVATE metadump GTest::GTest) diff --git a/test/simple.cpp b/test/simple.cpp new file mode 100644 index 0000000..135ffac --- /dev/null +++ b/test/simple.cpp @@ -0,0 +1,11 @@ +#include +#include "metadump.hpp" + +TEST(METADUMP_SIMPLE, EMPTY) { + ASSERT_TRUE(false) << "Tests not implemented!"; +} + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}