From 88bc5cb0a19f312caf86dd29d388aa3194ab6943 Mon Sep 17 00:00:00 2001 From: Faruk Eryilmaz Date: Mon, 8 Jan 2024 23:33:24 +0300 Subject: [PATCH] configure tests as optional in CMake and adjust GitHub Actions workflows --- .github/workflows/platform_gnu_linux.yml | 2 +- .github/workflows/platform_macos.yml | 2 +- .github/workflows/platform_windows.yml | 2 +- CMakeLists.txt | 12 ++++++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/platform_gnu_linux.yml b/.github/workflows/platform_gnu_linux.yml index c66daba..f588b1b 100644 --- a/.github/workflows/platform_gnu_linux.yml +++ b/.github/workflows/platform_gnu_linux.yml @@ -37,7 +37,7 @@ jobs: with: submodules: 'true' - name: Configure - run: cmake -S . -B build + run: cmake -S . -B build -DBYTEPACK_BUILD_TESTS=ON - name: Build run: cmake --build build - name: Run tests diff --git a/.github/workflows/platform_macos.yml b/.github/workflows/platform_macos.yml index 06f98a5..b667222 100644 --- a/.github/workflows/platform_macos.yml +++ b/.github/workflows/platform_macos.yml @@ -18,7 +18,7 @@ jobs: with: submodules: 'true' - name: Configure - run: cmake -S . -B build + run: cmake -S . -B build -DBYTEPACK_BUILD_TESTS=ON - name: Build run: cmake --build build - name: Run tests diff --git a/.github/workflows/platform_windows.yml b/.github/workflows/platform_windows.yml index 515441d..e21677e 100644 --- a/.github/workflows/platform_windows.yml +++ b/.github/workflows/platform_windows.yml @@ -15,7 +15,7 @@ jobs: with: submodules: 'true' - name: Configure - run: cmake -S . -B build -DCMAKE_CXX_STANDARD=20 + run: cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DBYTEPACK_BUILD_TESTS=ON - name: Build run: cmake --build build --config Release - name: Run tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 95f220d..6577ad1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,11 @@ endif() add_library(bytepack INTERFACE) target_include_directories(bytepack INTERFACE ${PROJECT_SOURCE_DIR}/include) -add_subdirectory(extern/Catch2) - -enable_testing() -add_subdirectory(test) +# Option for building tests +option(BYTEPACK_BUILD_TESTS "Build the BytePack tests" OFF) +if(BYTEPACK_BUILD_TESTS) + message("Build the BytePack tests") + add_subdirectory(extern/Catch2) + enable_testing() + add_subdirectory(test) +endif()