summaryrefslogtreecommitdiffstats
path: root/cmake/FindWrapLibSystemd.cmake
blob: c681daea4a980c2e992e396a9d31ae8ea6326aa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# We can't create the same interface imported target multiple times, CMake will complain if we do
# that. This can happen if the find_package call is done in multiple different subdirectories.
if(TARGET WrapLibSystemd::WrapLibSystemd)
    set(WrapLibSystemd_FOUND TRUE)
    return()
endif()

find_package(PkgConfig)
pkg_check_modules(pc_libsystemd libsystemd>=183 IMPORTED_TARGET)


if (NOT pc_libsystemd_FOUND)
    set(WrapLibSystemd_FOUND FALSE)
    return()
endif()

add_library(WrapLibSystemd::WrapLibSystemd INTERFACE IMPORTED)
target_link_libraries(WrapLibSystemd::WrapLibSystemd INTERFACE ${pc_libsystemd_LIBRARIES})
set(WrapLibSystemd_FOUND TRUE)