cmake: factor the libogg dependency

This commit is contained in:
Frédéric Mangano-Tarumi 2018-11-10 14:00:13 -05:00
parent 132073b842
commit 3aeb2097de
2 changed files with 7 additions and 16 deletions

View File

@ -9,8 +9,9 @@ project(
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FindPkgConfig)
find_package(PkgConfig REQUIRED)
pkg_check_modules(OGG REQUIRED ogg)
add_compile_options(${OGG_CFLAGS})
configure_file(src/config.h.in config.h @ONLY)
include_directories(BEFORE src "${CMAKE_BINARY_DIR}")
@ -22,14 +23,10 @@ add_library(
src/ogg.cc
src/opus.cc
)
target_link_libraries(libopustags PUBLIC ${OGG_LIBRARIES})
add_executable(
opustags
src/opustags.cc
$<TARGET_OBJECTS:libopustags>
)
target_compile_options(opustags PUBLIC ${OGG_CFLAGS})
target_link_libraries(opustags PUBLIC ${OGG_LIBRARIES})
add_executable(opustags src/opustags.cc)
target_link_libraries(opustags libopustags)
include(GNUInstallDirs)
install(TARGETS opustags DESTINATION "${CMAKE_INSTALL_BINDIR}")

View File

@ -1,11 +1,5 @@
add_executable(
unit.t
EXCLUDE_FROM_ALL
unit.cc
$<TARGET_OBJECTS:libopustags>
)
target_compile_options(unit.t PUBLIC ${OGG_CFLAGS})
target_link_libraries(unit.t PUBLIC ${OGG_LIBRARIES})
add_executable(unit.t EXCLUDE_FROM_ALL unit.cc)
target_link_libraries(unit.t libopustags)
add_custom_target(
check