From 754012dd458985a6a4953c99204c6651318892b2 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 23 Mar 2026 08:10:49 +0100 Subject: testing: enable build-host testing --- CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 7654ed0..f4c3762 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,21 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules") include("ElfTransformations") include("GenerateBootableIso") +#[============================================================================[ +# External Dependencies +#]============================================================================] + +include("FetchContent") + +FetchContent_Declare( + "Catch2" + GIT_REPOSITORY "https://github.com/catchorg/Catch2.git" + GIT_TAG "v3.13.0" + FIND_PACKAGE_ARGS +) + +FetchContent_MakeAvailable("Catch2") + #[============================================================================[ # Global Build System Options #]============================================================================] @@ -70,7 +85,20 @@ endif() # Global Targets #]============================================================================] -add_subdirectory("arch/${CMAKE_SYSTEM_PROCESSOR}") -add_subdirectory("kapi") -add_subdirectory("libs") -add_subdirectory("kernel") \ No newline at end of file +if(CMAKE_CROSSCOMPILING) + add_subdirectory("arch/${CMAKE_SYSTEM_PROCESSOR}") + add_subdirectory("kernel") + add_subdirectory("kapi") + add_subdirectory("libs") +else() + enable_testing() + find_package("Catch2") + include("Catch") + + set_target_properties("Catch2" "Catch2WithMain" PROPERTIES + C_CLANG_TIDY "" + CXX_CLANG_TIDY "" + ) + + add_subdirectory("libs") +endif() -- cgit v1.2.3