Commit 1c5b1ad4 authored by Rolf Eike Beer's avatar Rolf Eike Beer

FindALSA: add testcase

parent 6a64292f
......@@ -1368,6 +1368,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
endif()
if(CMake_TEST_FindALSA)
add_subdirectory(FindALSA)
endif()
if(CMake_TEST_CUDA)
add_subdirectory(Cuda)
add_subdirectory(CudaOnly)
......
add_test(NAME FindALSA.Test COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindALSA/Test"
"${CMake_BINARY_DIR}/Tests/FindALSA/Test"
${build_generator_args}
--build-project TestFindALSA
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
cmake_minimum_required(VERSION 3.10)
project(TestFindALSA C)
include(CTest)
find_package(ALSA REQUIRED)
add_definitions(-DCMAKE_EXPECTED_ALSA_VERSION="${ALSA_VERSION_STRING}")
add_executable(test_tgt main.c)
target_link_libraries(test_tgt ALSA::ALSA)
add_test(NAME test_tgt COMMAND test_tgt)
add_executable(test_var main.c)
target_include_directories(test_var PRIVATE ${ALSA_INCLUDE_DIRS})
target_link_libraries(test_var PRIVATE ${ALSA_LIBRARIES})
add_test(NAME test_var COMMAND test_var)
#include <alsa/global.h>
#include <stdio.h>
#include <string.h>
int main()
{
printf("Found ALSA version %s, expected version %s\n",
snd_asoundlib_version(), CMAKE_EXPECTED_ALSA_VERSION);
return strcmp(snd_asoundlib_version(), CMAKE_EXPECTED_ALSA_VERSION);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment