CMakeLists.txt: make tests optional

Run test-strbuf using ctest.
This commit is contained in:
Anna “CyberTailor”
2022-02-21 12:22:29 +05:00
parent 415c097489
commit aa9dd9c155
3 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -45,8 +45,8 @@ jobs:
- name: Run flashfetch
run: ./flashfetch
- name: Run fastfetch-test-strbuf
run: ./fastfetch-test-strbuf
- name: Run tests
run: ctest
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
+18 -12
View File
@@ -16,6 +16,7 @@ OPTION(ENABLE_DCONF "Enable dconf" ON)
OPTION(ENABLE_DBUS "Enable dbus-1" ON)
OPTION(ENABLE_XFCONF "Enable libxfconf-0" ON)
OPTION(ENABLE_RPM "Enable rpm" ON)
OPTION(BUILD_TESTS "Build tests" ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
@@ -277,19 +278,24 @@ target_link_libraries(flashfetch
# Testing.
add_executable(fastfetch-test-performance
tests/performance.c
)
target_link_libraries(fastfetch-test-performance
PRIVATE libfastfetch
)
if (BUILD_TESTS)
add_executable(fastfetch-test-performance
tests/performance.c
)
target_link_libraries(fastfetch-test-performance
PRIVATE libfastfetch
)
add_executable(fastfetch-test-strbuf
tests/strbuf.c
)
target_link_libraries(fastfetch-test-strbuf
PRIVATE libfastfetch
)
add_executable(fastfetch-test-strbuf
tests/strbuf.c
)
target_link_libraries(fastfetch-test-strbuf
PRIVATE libfastfetch
)
enable_testing()
add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)
endif()
# Installation.
-6
View File
@@ -1,6 +0,0 @@
#!/bin/env sh
mkdir -p build/
cd build
cmake ..
cmake --build . --target fastfetch-test-strbuf -j$(nproc)
./fastfetch-test-strbuf "$@"