Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Properly enable unit tests #658

Merged
merged 1 commit into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ if (ENABLE_DOCS)
endif()

############# PROCESS tests/ DIRECTORY ##############
set(BUILD_TESTS ${ENABLE_TESTS})
set(CAN_BUILD_TESTS ${ENABLE_TESTS})
find_package(Catch2 QUIET)
if(NOT Catch2_FOUND)
set(BUILD_TESTS FALSE)
set(CAN_BUILD_TESTS FALSE)
endif()
if(BUILD_TESTS)
if(CAN_BUILD_TESTS)
if(ENABLE_PARALLEL_CTEST)
# Figure out the amount of parallelism for CTest
include(ProcessorCount)
Expand All @@ -192,7 +192,7 @@ if(BUILD_TESTS)
include(Catch)
add_subdirectory(tests)
endif()
add_feature_info("Unit tests" BUILD_TESTS "Compile unit tests for library functions")
add_feature_info("Unit tests" CAN_BUILD_TESTS "Compile unit tests for library functions")

############## COVERAGE REPORTING #################
if (ENABLE_COVERAGE AND DEFINED UNIT_TEST_TARGETS)
Expand All @@ -210,7 +210,7 @@ if (ENABLE_COVERAGE AND DEFINED UNIT_TEST_TARGETS)
)
endif()

if(BUILD_TESTS AND NOT TARGET coverage)
if(CAN_BUILD_TESTS AND NOT TARGET coverage)
add_custom_target(coverage
COMMAND ctest ${CTEST_OPTIONS}
DEPENDS openshot ${UNIT_TEST_TARGETS}
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ endif()
###
### Catch2 unit tests
###
if (TESTS_ENABLED)
if (CAN_BUILD_TESTS)
include(Catch)
include(CTest)

Expand Down