distromatic/src/CMakeLists.txt

79 lines
1.7 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)
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(
PACKAGE="Distromatic"
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}
${LIBIBERTY}
)
target_include_directories(distromatic PUBLIC ${RPM_INCLUDE_DIRS})
#
# NOTE: -fno-toplevel-reorder required to prevent Sqlite3 weird problems
#
target_compile_options(distromatic PUBLIC -O2 -fno-toplevel-reorder -g -Wall -std=gnu11 -pedantic ${RPM_CFLAGS_OTHER})
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}
${LIBIBERTY}
)
target_include_directories(distroquery PUBLIC ${RPM_INCLUDE_DIRS})
install(
TARGETS distromatic
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
install(
TARGETS distroquery
DESTINATION /var/www/cgi-bin/
)