1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
cmake_minimum_required (VERSION 3.16)
project(user-session-migration VERSION 0.5.0 LANGUAGES C)
include(GNUInstallDirs)
option(ENABLE_RPM "enable rpm support")
if(ENABLE_RPM)
set(RPM "RPM-NOTFOUND" CACHE STRING "rpm executable location")
find_program(RPM "rpm" DOC "rpm executable location")
if(${RPM} STREQUAL "RPM-NOTFOUND")
message(FATAL_ERROR "rpm executable not found")
endif()
execute_process(COMMAND ${RPM} --eval %{_rpmconfigdir}
OUTPUT_VARIABLE RPM_RPMCONFIGDIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${RPM} --eval %{_fileattrsdir}
OUTPUT_VARIABLE RPM_FILEATTRSDIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
set(RPM_INSTALL_FULL_RPMCONFIGDIR "${RPM_RPMCONFIGDIR}"
CACHE STRING "rpm configuration directory")
set(RPM_INSTALL_FULL_FILEATTRSDIR "${RPM_FILEATTRSDIR}"
CACHE STRING "rpm attribute files directory")
message(STATUS "rpm support: ${ENABLE_RPM} (${RPM})")
find_package (PkgConfig)
pkg_check_modules (CACHED_SESSIONMIGRATION_DEPS REQUIRED "glib-2.0>=2.76")
pkg_get_variable (SYSTEMD_USER_UNIT_DIR systemd systemduserunitdir)
# tests dependencies
find_package (Python3 COMPONENTS Interpreter)
find_program(DPKG_BUILDPACKAGE "dpkg-buildpackage" DOC "dpkg-buildpackage executable location")
if(ENABLE_RPM)
add_subdirectory(rpm)
endif(ENABLE_RPM)
add_subdirectory(data)
add_subdirectory(src)
enable_testing()
# debhelper/ is expected to be there by a test
file(COPY debhelper
DESTINATION ${PROJECT_BINARY_DIR})
add_subdirectory(tests)
macro(add_manpages target manpages translations)
foreach(man ${manpages})
string(LENGTH ${man} manpage_length)
math(EXPR manpage_length ${manpage_length}-1)
string(SUBSTRING ${man} ${manpage_length} 1 section)
install(FILES ${man} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section})
if (USE_NLS)
foreach(translation ${translations})
set(transdir ${CMAKE_CURRENT_BINARY_DIR}/${translation})
add_po4a(man ${man} po/${translation}.po ${transdir}/${man} "")
install(FILES ${transdir}/${man}
DESTINATION ${CMAKE_INSTALL_MANDIR}/${translation}/man${section})
set(files ${files} ${transdir}/${man})
endforeach(translation ${translations})
endif(USE_NLS)
endforeach(man ${manpages})
add_custom_target(${target} ALL DEPENDS ${files})
endmacro(add_manpages target manpages translations)
add_manpages(doc-rawman user-session-migration.1 "en;")
|