summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2019-01-29 13:00:41 +1100
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2019-01-29 13:17:26 +1100
commit2b26533b81621dbf1359c5e64dd7a59e6d327f62 (patch)
tree454480a155fc9e6df12eeeb48c20e48529170310 /CMakeLists.txt
parent63e60e178c215215b549bd441f83e8779cbd8cbe (diff)
Add support for installing as a library
Need to install in AGL SDK rather than use as a submodule. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt28
1 files changed, 27 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d56960b..9ae3089 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,24 @@
# LIBAVIRT CONFIGURATION LIBRARY
#-------------------------------------------------------------------------------
-PROJECT_TARGET_ADD(avirt)
+cmake_minimum_required(VERSION 3.3)
+
+include(GNUInstallDirs)
+
+set(TARGET_NAME "avirt")
+set(PROJECT_PRETTY_NAME "AVIRT")
+set(PROJECT_DESCRIPTION "ALSA Virtual Dynamic Sound Driver userspace library")
+set(PROJECT_URL "https://gerrit.automotivelinux.org:29418/src/libavirt")
+set(PROJECT_AUTHOR "Farrugia, Mark")
+set(PROJECT_AUTHOR_MAIL "mark.farrugia@fiberdyne.com.au")
+set(PROJECT_LICENSE "APL2.0")
+set(PROJECT_LANGUAGES "C")
+
+if(NOT CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX "/usr")
+endif()
+
+add_compile_options(-DAFB_BINDING_VERSION=3 -Wall -Wextra -Wconversion -Wno-unused-parameter -Wno-sign-compare -Wno-sign-conversion -Werror=maybe-uninitialized -Werror=implicit-function-declaration -ffunction-sections -fdata-sections -fPIC)
# Target
file(GLOB SOURCE_FILES "src/avirt-*.c")
@@ -10,3 +27,12 @@ add_library(avirt STATIC ${SOURCE_FILES})
# Target includes
target_include_directories(avirt PUBLIC include)
+
+# Install
+configure_file(avirt.pc.in avirt.pc @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/avirt.pc
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+install(TARGETS ${TARGET_NAME}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(FILES avirt/avirt.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/avirt)