distromatic/src/CMakeLists.txt

103 lines
2.3 KiB
CMake
Raw Normal View History

2020-06-18 13:55:52 +02:00
find_package(ZLIB REQUIRED)
find_package(PkgConfig)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
pkg_check_modules(RPM REQUIRED rpm)
pkg_check_modules(SQLITE3 REQUIRED sqlite3)
pkg_check_modules(LIBUNWIND REQUIRED libunwind)
pkg_check_modules(LIBREPO REQUIRED librepo)
pkg_check_modules(LIBDW REQUIRED libdw)
pkg_check_modules(LIBXML2 REQUIRED libxml-2.0)
2020-06-18 13:55:52 +02:00
find_library(LIBIBERTY NAMES iberty)
include_directories(include)
string(REPLACE "." ";" VERSION_LIST ${RPM_VERSION})
list(GET VERSION_LIST 0 RPM_VERSION_MAJOR)
list(GET VERSION_LIST 1 RPM_VERSION_MINOR)
list(GET VERSION_LIST 2 RPM_VERSION_MICRO)
add_compile_definitions(
2020-06-27 16:30:53 +02:00
PACKAGE="distromatic"
PACKAGE_NAME="Distromatic"
2020-06-18 13:55:52 +02:00
PACKAGE_VERSION="1.5.0"
DEFAULT_CONFIGFILE="/etc/distromatic.conf"
off64_t=__off64_t
RPM_VERSION_MAJOR=${RPM_VERSION_MAJOR}
RPM_VERSION_MINOR=${RPM_VERSION_MINOR}
RPM_VERSION_MICRO=${RPM_VERSION_MICRO}
LOCALEDIR="${LOCALEDIR}"
)
add_executable(distromatic
buildtools.c
changelog.c
distromatic.c
functions.c
reports.c
headerlist.c
requirelist.c
rpmfunctions.c
backend-sqlite3.c
)
target_link_libraries(distromatic
Threads::Threads
${RPM_LIBRARIES}
${ZLIB_LIBRARIES}
${SQLITE3_LIBRARIES}
${LIBREPO_LIBRARIES}
${LIBXML2_LIBRARIES}
${LIBUNWIND_LIBRARIES}
${LIBDW_LIBRARIES}
2020-06-18 13:55:52 +02:00
${LIBIBERTY}
)
target_include_directories(distromatic PUBLIC
${RPM_INCLUDE_DIRS}
${LIBREPO_INCLUDE_DIRS}
${LIBXML2_INCLUDE_DIRS}
${LIBUNWIND_INCLUDE_DIRS}
)
#
# NOTE: -fno-toplevel-reorder required to prevent Sqlite3 weird problems
#
2021-02-16 20:24:29 +01:00
target_compile_options(distromatic PUBLIC -O2 -g -Wall -std=gnu11 -pedantic ${RPM_CFLAGS_OTHER})
# -fno-toplevel-reorder
2020-06-18 13:55:52 +02:00
add_executable(distroquery
distroquery.c
functions.c
headerlist.c
requirelist.c
rpmfunctions.c
changelog.c
)
target_link_libraries(distroquery
Threads::Threads
${RPM_LIBRARIES}
${ZLIB_LIBRARIES}
${SQLITE3_LIBRARIES}
${LIBREPO_LIBRARIES}
${LIBXML2_LIBRARIES}
${LIBUNWIND_LIBRARIES}
${LIBDW_LIBRARIES}
2020-06-18 13:55:52 +02:00
${LIBIBERTY}
)
target_include_directories(distroquery PUBLIC
${RPM_INCLUDE_DIRS}
${LIBREPO_INCLUDE_DIRS}
${LIBXML2_INCLUDE_DIRS}
${LIBUNWIND_INCLUDE_DIRS}
)
install(
TARGETS distromatic
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
install(
TARGETS distroquery
DESTINATION /var/www/cgi-bin/
)