build the project with cmake

This commit is contained in:
Frédéric Mangano-Tarumi 2018-10-30 19:14:34 -04:00
parent 241c9b3071
commit 65aad6f62a
4 changed files with 35 additions and 31 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
/opustags
/opustags.1.gz
/build

23
CMakeLists.txt Normal file
View File

@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.9)
project(
opustags
VERSION 1.2.0
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FindPkgConfig)
pkg_check_modules(OGG REQUIRED ogg)
add_executable(opustags opustags.cc)
target_compile_options(opustags PUBLIC ${OGG_CFLAGS})
target_link_libraries(opustags PUBLIC ${OGG_LIBRARIES})
include(GNUInstallDirs)
install(TARGETS opustags DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES opustags.1 DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
add_custom_target(check COMMAND prove "${CMAKE_SOURCE_DIR}/t")

View File

@ -1,28 +0,0 @@
DESTDIR=/usr/local
MANDEST=share/man
CXXFLAGS=-Wall -std=c++14
LDFLAGS=-logg
all: opustags
opustags: opustags.cc
man: opustags.1
gzip <opustags.1 >opustags.1.gz
install: opustags man
mkdir -p $(DESTDIR)/bin $(DESTDIR)/$(MANDEST)/man1
install -m 755 opustags $(DESTDIR)/bin/
install -m 644 opustags.1.gz $(DESTDIR)/$(MANDEST)/man1/
uninstall:
rm -f $(DESTDIR)/bin/opustags
rm -f $(DESTDIR)/$(MANDEST)/man1/opustags.1.gz
clean:
rm -f opustags opustags.1.gz
check: opustags
prove
.PHONY: all man install uninstall clean check

View File

@ -27,14 +27,24 @@ Requirements
------------
* a C++14 compiler,
* CMake,
* a POSIX-compliant system,
* libogg.
Installing
----------
opustags is a commonplace CMake project.
Here's how to install it in your .local, under your home:
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
make
make DESTDIR=/usr/local install
make install
Note that you don't need to install opustags in order to run it, as the executable is standalone.
Documentation
-------------