summaryrefslogtreecommitdiff
path: root/apt-inst
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-08-10 16:19:00 +0200
committerJulian Andres Klode <jak@debian.org>2016-08-10 16:19:00 +0200
commite02c3a9ec2b2f7a8d4aecd70f2ecdae27c207aa9 (patch)
treeffa99f96949f3eab728a1b8caecdd014ea8d6f81 /apt-inst
parentb2cfacf1180e4b3fcbb2ae2ea52cf270ef74e971 (diff)
parent61fef4ddbec8f70bb9e213ac0491d4e6cfefab30 (diff)
Merge branch 'cmake'
Diffstat (limited to 'apt-inst')
-rw-r--r--apt-inst/CMakeLists.txt26
-rw-r--r--apt-inst/makefile26
2 files changed, 26 insertions, 26 deletions
diff --git a/apt-inst/CMakeLists.txt b/apt-inst/CMakeLists.txt
new file mode 100644
index 000000000..f7578231a
--- /dev/null
+++ b/apt-inst/CMakeLists.txt
@@ -0,0 +1,26 @@
+# Include apt-pkg directly, as some files have #include <system.h>
+include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg)
+
+# Set the version of the library
+set(MAJOR 2.0)
+set(MINOR 0)
+set(APT_INST_MAJOR ${MAJOR} PARENT_SCOPE)
+
+# Definition of the C++ files used to build the library
+file(GLOB_RECURSE library "*.cc")
+file(GLOB_RECURSE headers "*.h")
+
+# Create a library using the C++ files
+add_library(apt-inst SHARED ${library})
+
+# Link the library and set the SONAME
+target_link_libraries(apt-inst PUBLIC apt-pkg ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(apt-inst PRIVATE ${CMAKE_THREAD_LIBS_INIT})
+set_target_properties(apt-inst PROPERTIES VERSION ${MAJOR}.${MINOR})
+set_target_properties(apt-inst PROPERTIES SOVERSION ${MAJOR})
+add_version_script(apt-inst)
+
+# Install the library and the headers
+install(TARGETS apt-inst LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/apt-pkg)
+flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}")
diff --git a/apt-inst/makefile b/apt-inst/makefile
deleted file mode 100644
index 5601cd9e6..000000000
--- a/apt-inst/makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- make -*-
-BASE=..
-SUBDIR=apt-inst
-
-# Header location
-SUBDIRS = contrib deb
-HEADER_TARGETDIRS = apt-pkg
-
-# Bring in the default rules
-include ../buildlib/defaults.mak
-
-# The library name and version (indirectly used from init.h)
-include ../buildlib/libversion.mak
-
-# The library name
-LIBRARY=apt-inst
-MAJOR=2.0
-MINOR=0
-SLIBS=$(PTHREADLIB) -lapt-pkg
-APT_DOMAIN:=libapt-inst$(MAJOR)
-LIBRARYDEPENDS=$(LIB)/libapt-pkg.so
-
-SOURCE = $(sort $(wildcard *.cc */*.cc))
-HEADERS = $(addprefix apt-pkg/,$(notdir $(sort $(wildcard *.h */*.h))))
-
-include $(LIBRARY_H)