From 99d5d2c8efaaa2e9d98f60fee89de5ca1ecbe7ac Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Mon, 4 Nov 2024 20:36:29 -0800 Subject: [PATCH] introduce test building cmake arg --- CMakeLists.txt | 1 + lib/CMakeLists.txt | 4 ++-- lib/{ => tests}/bittest.c | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename lib/{ => tests}/bittest.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f4fcc1..8b5678e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ set(CMAKE_C_STANDARD 23) OPTION(VANILLA_BUILD_DESKTOP "Build Qt app for Linux desktop" ON) OPTION(VANILLA_BUILD_RPI "Build SDL2 app for Raspberry Pi" OFF) +OPTION(VANILLA_BUILD_TESTS "Build unit tests for Vanilla" OFF) add_subdirectory(lib) if (NOT ANDROID) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f2ecc0e..75b4d0d 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -21,9 +21,9 @@ endif() install(TARGETS vanilla) -if (0) +if (VANILLA_BUILD_TESTS) add_executable(bittest - bittest.c + tests/bittest.c ) target_link_libraries(bittest PRIVATE vanilla m) diff --git a/lib/bittest.c b/lib/tests/bittest.c similarity index 100% rename from lib/bittest.c rename to lib/tests/bittest.c