Skip to content

Commit af83903

Browse files
authored
Merge pull request #349 from ferdnyc/disable-tests
DISABLE_TESTS covers entire tests/ dir
2 parents 178c8e2 + 6459464 commit af83903

File tree

2 files changed

+49
-50
lines changed

2 files changed

+49
-50
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,6 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html/
115115
endif()
116116

117117
############# PROCESS tests/ DIRECTORY ##############
118-
add_subdirectory(tests)
119-
118+
if(NOT DISABLE_TESTS)
119+
add_subdirectory(tests)
120+
endif()

tests/CMakeLists.txt

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -160,52 +160,50 @@ else()
160160
include_directories("../thirdparty/jsoncpp")
161161
endif(USE_SYSTEM_JSONCPP)
162162

163-
IF (NOT DISABLE_TESTS)
164-
############### SET TEST SOURCE FILES #################
165-
SET ( OPENSHOT_TEST_FILES
166-
Cache_Tests.cpp
167-
Clip_Tests.cpp
168-
Color_Tests.cpp
169-
Coordinate_Tests.cpp
170-
ReaderBase_Tests.cpp
171-
ImageWriter_Tests.cpp
172-
FFmpegReader_Tests.cpp
173-
FFmpegWriter_Tests.cpp
174-
Fraction_Tests.cpp
175-
FrameMapper_Tests.cpp
176-
KeyFrame_Tests.cpp
177-
Point_Tests.cpp
178-
Settings_Tests.cpp
179-
Timeline_Tests.cpp )
180-
181-
################ TESTER EXECUTABLE #################
182-
# Create unit test executable (openshot-test)
183-
message (STATUS "Tests enabled, test executable will be built as tests/openshot-test")
184-
add_executable(openshot-test
185-
tests.cpp
186-
${OPENSHOT_TEST_FILES} )
187-
188-
# Link libraries to the new executable
189-
target_link_libraries(openshot-test openshot ${UNITTEST++_LIBRARY})
190-
191-
##### RUNNING TESTS (make os_test / make test) #####
192-
# Hook up the 'make os_test' target to the 'openshot-test' executable
193-
ADD_CUSTOM_TARGET(os_test COMMAND openshot-test)
194-
list(APPEND OS_TEST_CMDS "'make os_test'")
195-
196-
# Also hook up 'make test', if possible
197-
# This requires CMake 3.11+, where the CMP0037 policy
198-
# configured to 'NEW' mode will not reserve target names
199-
# unless the corresponding feature is actually used
200-
if (POLICY CMP0037)
201-
cmake_policy(SET CMP0037 NEW)
202-
endif()
203-
if (CMAKE_VERSION VERSION_GREATER 3.11)
204-
message(STATUS "Cmake 3.11+ detected, enabling 'test' target")
205-
add_custom_target(test COMMAND openshot-test)
206-
list(APPEND OS_TEST_CMDS " or " "'make test'")
207-
endif()
208-
209-
string(CONCAT t ${OS_TEST_CMDS})
210-
message("\nTo run unit tests, use: ${t}")
163+
############### SET TEST SOURCE FILES #################
164+
SET ( OPENSHOT_TEST_FILES
165+
Cache_Tests.cpp
166+
Clip_Tests.cpp
167+
Color_Tests.cpp
168+
Coordinate_Tests.cpp
169+
ReaderBase_Tests.cpp
170+
ImageWriter_Tests.cpp
171+
FFmpegReader_Tests.cpp
172+
FFmpegWriter_Tests.cpp
173+
Fraction_Tests.cpp
174+
FrameMapper_Tests.cpp
175+
KeyFrame_Tests.cpp
176+
Point_Tests.cpp
177+
Settings_Tests.cpp
178+
Timeline_Tests.cpp )
179+
180+
################ TESTER EXECUTABLE #################
181+
# Create unit test executable (openshot-test)
182+
message (STATUS "Tests enabled, test executable will be built as tests/openshot-test")
183+
add_executable(openshot-test
184+
tests.cpp
185+
${OPENSHOT_TEST_FILES} )
186+
187+
# Link libraries to the new executable
188+
target_link_libraries(openshot-test openshot ${UNITTEST++_LIBRARY})
189+
190+
##### RUNNING TESTS (make os_test / make test) #####
191+
# Hook up the 'make os_test' target to the 'openshot-test' executable
192+
ADD_CUSTOM_TARGET(os_test COMMAND openshot-test)
193+
list(APPEND OS_TEST_CMDS "'make os_test'")
194+
195+
# Also hook up 'make test', if possible
196+
# This requires CMake 3.11+, where the CMP0037 policy
197+
# configured to 'NEW' mode will not reserve target names
198+
# unless the corresponding feature is actually used
199+
if (POLICY CMP0037)
200+
cmake_policy(SET CMP0037 NEW)
211201
endif()
202+
if (CMAKE_VERSION VERSION_GREATER 3.11)
203+
message(STATUS "Cmake 3.11+ detected, enabling 'test' target")
204+
add_custom_target(test COMMAND openshot-test)
205+
list(APPEND OS_TEST_CMDS " or " "'make test'")
206+
endif()
207+
208+
string(CONCAT t ${OS_TEST_CMDS})
209+
message("\nTo run unit tests, use: ${t}")

0 commit comments

Comments
 (0)