From ade2dd9bfc0921cda5c08c158d87cacbadc738b3 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sun, 4 Aug 2024 22:06:14 +0700 Subject: [PATCH] build: add `MUSEN_BUILD_TESTS` option --- .github/workflows/build-and-test.yml | 2 +- CMakeLists.txt | 4 +++- README.md | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 93cfa98..87cfbea 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -15,7 +15,7 @@ jobs: - name: Build project uses: threeal/cmake-action@v1.3.0 with: - options: BUILD_TESTING=ON + options: MUSEN_BUILD_TESTS=ON run-build: true - name: Test project diff --git a/CMakeLists.txt b/CMakeLists.txt index f5da426..76219dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.5) project(musen) +option(MUSEN_BUILD_TESTS "Build test targets.") + function(cpmaddpackage) file( DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.1/CPM.cmake @@ -42,7 +44,7 @@ install(TARGETS ${PROJECT_NAME} add_subdirectory("examples") -if(BUILD_TESTING) +if(MUSEN_BUILD_TESTS) enable_testing() add_subdirectory("test/gtest") endif() diff --git a/README.md b/README.md index 0d71c0f..66089e6 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ See [releases](https://github.com/ichiro-its/musen/releases) for the latest vers ``` - (Optional) reconfigure CMake to run the unit tests. ```sh - $ cmake -DBUILD_TESTING=ON .. && make && ctest --verbose + $ cmake -DMUSEN_BUILD_TESTS=ON .. && make && ctest --verbose ``` ## Usages