Debian Codegraph @

cmake/FindRPM.cmake

raw
1 # - Try to find RPM
2 # Once done, this will define
3 #
4 # RPM_FOUND - system has RPM
5 # RPM_INCLUDE_DIRS - the RPM include directories
6 # RPM_LIBRARIES - link these to use RPM
7
8 include(LibFindMacros)
9
10 # Use pkg-config to get hints about paths
11 libfind_pkg_check_modules(RPM_PKGCONF rpm)
12
13 # Include dir
14 find_path(RPM_INCLUDE_DIR
15 NAMES rpm
16 PATHS ${RPM_PKGCONF_INCLUDE_DIRS}
17 )
18
19 # Finally the library itself
20 find_library(RPM_LIBRARY
21 NAMES rpm
22 PATHS ${RPM_PKGCONF_LIBRARY_DIRS}
23 )
24 find_library(RPMIO_LIBRARY
25 NAMES rpmio
26 PATHS ${RPM_PKGCONF_LIBRARY_DIRS}
27 )
28
29 set(RPM_VERSION ${RPM_PKGCONF_VERSION})
30 if(RPM_VERSION)
31 if(RPM_VERSION VERSION_GREATER_EQUAL "4.18")
32 set(RPM418_FOUND 1)
33 endif()
34 if(RPM_VERSION VERSION_GREATER_EQUAL "4.6")
35 set(RPM46_FOUND 1)
36 endif()
37 if(RPM_VERSION VERSION_GREATER_EQUAL "4.7")
38 set(RPM47_FOUND 1)
39 endif()
40 endif()
41
42 # Set the include dir variables and the libraries and let libfind_process do the rest.
43 # NOTE: Singular variables for this library, plural for libraries this this lib depends on.
44 set(RPM_PROCESS_INCLUDES RPM_INCLUDE_DIR)
45 set(RPM_PROCESS_LIBS RPM_LIBRARY RPMIO_LIBRARY)
46 libfind_process(RPM)