kraken: bootstrap build system

This commit is contained in:
Bruno BELANYI 2022-03-11 23:12:10 +01:00
commit 5cd9e11979
6 changed files with 49 additions and 0 deletions

19
CMakeLists.txt Normal file
View file

@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.13)
project(kraken VERSION 0.0.0 LANGUAGES CXX)
enable_testing()
# Add a dummy target to share all our compile options
add_library(common_options INTERFACE)
target_compile_features(common_options INTERFACE
cxx_std_20
)
target_compile_options(common_options INTERFACE
-Wall
-Wextra
)
target_include_directories(common_options INTERFACE
src
)
add_subdirectory(src)
add_subdirectory(tests)

4
src/CMakeLists.txt Normal file
View file

@ -0,0 +1,4 @@
add_executable(kraken kraken.cc)
target_link_libraries(kraken PRIVATE common_options)
install(TARGETS kraken)

5
src/kraken.cc Normal file
View file

@ -0,0 +1,5 @@
#include <iostream>
int main() {
std::cout << "Hello World!\n";
}

1
tests/CMakeLists.txt Normal file
View file

@ -0,0 +1 @@
add_subdirectory(unit)

15
tests/unit/CMakeLists.txt Normal file
View file

@ -0,0 +1,15 @@
find_package(GTest)
if (${GTest_FOUND})
include(GoogleTest)
add_executable(base_test base.cc)
target_link_libraries(base_test PRIVATE common_options)
target_link_libraries(base_test PRIVATE
GTest::gtest
GTest::gtest_main
)
gtest_discover_tests(base_test)
endif (${GTest_FOUND})

5
tests/unit/base.cc Normal file
View file

@ -0,0 +1,5 @@
#include <gtest/gtest.h>
TEST(misc, passing) {
ASSERT_EQ(1, 1);
}