mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 06:00:30 -06:00
FindALSA: add testcase
This commit is contained in:
@@ -1368,6 +1368,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CMake_TEST_FindALSA)
|
||||||
|
add_subdirectory(FindALSA)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMake_TEST_CUDA)
|
if(CMake_TEST_CUDA)
|
||||||
add_subdirectory(Cuda)
|
add_subdirectory(Cuda)
|
||||||
add_subdirectory(CudaOnly)
|
add_subdirectory(CudaOnly)
|
||||||
|
|||||||
10
Tests/FindALSA/CMakeLists.txt
Normal file
10
Tests/FindALSA/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
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>
|
||||||
|
)
|
||||||
16
Tests/FindALSA/Test/CMakeLists.txt
Normal file
16
Tests/FindALSA/Test/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
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)
|
||||||
10
Tests/FindALSA/Test/main.c
Normal file
10
Tests/FindALSA/Test/main.c
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user