summaryrefslogtreecommitdiff
path: root/apt-pkg/CMakeLists.txt
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2017-09-10 11:35:54 +0200
committerJulian Andres Klode <jak@debian.org>2017-09-10 11:35:54 +0200
commitb13861fa687cf3a2af97a5beb0c0642d9bee8f8c (patch)
treec1efc2c6a8430ade8f27e48100fb44c8e2734310 /apt-pkg/CMakeLists.txt
parenta670cee0e0f4faba0d31919d9fa4f9c25b7d5867 (diff)
CMake: Properly handle Udev missing
When udev is not available, the variables for libraries and include paths are set to NOTFOUND rather than an empty string and CMake exits with an error. Use a generator expression to only use these variables when UDEV_FOUND is true.
Diffstat (limited to 'apt-pkg/CMakeLists.txt')
-rw-r--r--apt-pkg/CMakeLists.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt
index 651e55c79..2f5ad3200 100644
--- a/apt-pkg/CMakeLists.txt
+++ b/apt-pkg/CMakeLists.txt
@@ -44,7 +44,7 @@ target_include_directories(apt-pkg
${BZIP2_INCLUDE_DIR}
${LZMA_INCLUDE_DIRS}
${LZ4_INCLUDE_DIRS}
- ${UDEV_INCLUDE_DIRS}
+ $<$<BOOL:${UDEV_FOUND}>:${UDEV_INCLUDE_DIRS}>
${ICONV_INCLUDE_DIRS}
)
@@ -55,7 +55,7 @@ target_link_libraries(apt-pkg
${BZIP2_LIBRARIES}
${LZMA_LIBRARIES}
${LZ4_LIBRARIES}
- ${UDEV_LIBRARIES}
+ $<$<BOOL:${UDEV_FOUND}>:${UDEV_LIBRARIES}>
${ICONV_LIBRARIES}
)
set_target_properties(apt-pkg PROPERTIES VERSION ${MAJOR}.${MINOR})