Skip to content

Commit

Permalink
CMake: Properly enable unit tests (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Apr 19, 2021
1 parent 3457ffc commit 7a6ff7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions CMakeLists.txt
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
Expand Up @@ -76,7 +76,7 @@ endif()
###
### Catch2 unit tests
###
if (TESTS_ENABLED)
if (CAN_BUILD_TESTS)
include(Catch)
include(CTest)

Expand Down

0 comments on commit 7a6ff7c

Please sign in to comment.