diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a28f441c..02de9b74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -579,7 +579,7 @@ if(OPUS_BUILD_PROGRAMS) target_link_libraries(opus_compare PRIVATE opus ${OPUS_REQUIRED_LIBRARIES}) endif() -if(BUILD_TESTING) +if(BUILD_TESTING AND NOT BUILD_SHARED_LIBS) enable_testing() # tests @@ -590,29 +590,38 @@ if(BUILD_TESTING) if(OPUS_FIXED_POINT) target_compile_definitions(test_opus_decode PRIVATE DISABLE_FLOAT_API) endif() - add_test(NAME test_opus_decode COMMAND $<TARGET_FILE:test_opus_decode> WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + add_test(NAME test_opus_decode COMMAND ${CMAKE_COMMAND} + -DTEST_EXECUTABLE=$<TARGET_FILE:test_opus_decode> + -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} + -P "${PROJECT_SOURCE_DIR}/cmake/RunTest.cmake") add_executable(test_opus_padding ${test_opus_padding_sources}) target_include_directories(test_opus_padding PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(test_opus_padding PRIVATE opus) - add_test(NAME test_opus_padding COMMAND $<TARGET_FILE:test_opus_padding> WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - - if(NOT BUILD_SHARED_LIBS) - # disable tests that depends on private API when building shared lib - add_executable(test_opus_api ${test_opus_api_sources}) - target_include_directories(test_opus_api - PRIVATE ${CMAKE_CURRENT_BINARY_DIR} celt) - target_link_libraries(test_opus_api PRIVATE opus) - if(OPUS_FIXED_POINT) - target_compile_definitions(test_opus_api PRIVATE DISABLE_FLOAT_API) - endif() - add_test(NAME test_opus_api COMMAND $<TARGET_FILE:test_opus_api> WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - - add_executable(test_opus_encode ${test_opus_encode_sources}) - target_include_directories(test_opus_encode - PRIVATE ${CMAKE_CURRENT_BINARY_DIR} celt) - target_link_libraries(test_opus_encode PRIVATE opus) - add_test(NAME test_opus_encode COMMAND $<TARGET_FILE:test_opus_encode> WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + add_test(NAME test_opus_padding COMMAND ${CMAKE_COMMAND} + -DTEST_EXECUTABLE=$<TARGET_FILE:test_opus_padding> + -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} + -P "${PROJECT_SOURCE_DIR}/cmake/RunTest.cmake") + + add_executable(test_opus_api ${test_opus_api_sources}) + target_include_directories(test_opus_api + PRIVATE ${CMAKE_CURRENT_BINARY_DIR} celt) + target_link_libraries(test_opus_api PRIVATE opus) + if(OPUS_FIXED_POINT) + target_compile_definitions(test_opus_api PRIVATE DISABLE_FLOAT_API) endif() + add_test(NAME test_opus_api COMMAND ${CMAKE_COMMAND} + -DTEST_EXECUTABLE=$<TARGET_FILE:test_opus_api> + -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} + -P "${PROJECT_SOURCE_DIR}/cmake/RunTest.cmake") + + add_executable(test_opus_encode ${test_opus_encode_sources}) + target_include_directories(test_opus_encode + PRIVATE ${CMAKE_CURRENT_BINARY_DIR} celt) + target_link_libraries(test_opus_encode PRIVATE opus) + add_test(NAME test_opus_encode COMMAND ${CMAKE_COMMAND} + -DTEST_EXECUTABLE=$<TARGET_FILE:test_opus_encode> + -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} + -P "${PROJECT_SOURCE_DIR}/cmake/RunTest.cmake") endif() |