Skip to content

Commit

Permalink
Add tests to CMake project
Browse files Browse the repository at this point in the history
Related to #73.

Signed-off-by: Ralph Giles <[email protected]>
  • Loading branch information
evpobr authored and rillian committed Nov 6, 2020
1 parent 3c177d0 commit 83a82dd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ cmake:
- mkdir build
- cmake -S . -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release
- cmake --build build
- cd build
- ctest
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(vorbis)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# Required modules
include(CTest)
include(GNUInstallDirs)
include(CheckIncludeFiles)
include(CheckLibraryExists)
Expand Down Expand Up @@ -71,6 +72,10 @@ endif()

add_subdirectory(lib)

if(BUILD_TESTING)
add_subdirectory(test)
endif()

configure_pkg_config_file(vorbis.pc.in)
configure_pkg_config_file(vorbisenc.pc.in)
configure_pkg_config_file(vorbisfile.pc.in)
Expand Down
3 changes: 3 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_executable(vorbis_test util.c util.h write_read.c write_read.h test.c)
target_link_libraries(vorbis_test PRIVATE Vorbis::vorbisenc)
add_test(NAME vorbis_test COMMAND vorbis_test)
2 changes: 2 additions & 0 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include @OGG_CFLAGS@
test_SOURCES = util.c util.h write_read.c write_read.h test.c
test_LDADD = ../lib/libvorbisenc.la ../lib/libvorbis.la @OGG_LIBS@ @VORBIS_LIBS@

EXTRA_DIST = CMakeLists.txt

debug:
$(MAKE) check CFLAGS="@DEBUG@"

Expand Down

0 comments on commit 83a82dd

Please sign in to comment.