From cf2653c8bdbf08364184720492ee0ded972caa34 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Tue, 23 Feb 2021 09:51:22 +0100
Subject: [PATCH] cmake: Do not use TARGET_EXISTS generator exprs
The TARGET_EXISTS generator expression was introduced only in cmake 3.12
---
src/CMakeLists.txt | 65 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 52 insertions(+), 13 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4c0294e3..411b3ed2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -151,21 +151,60 @@ if(BUILD_LIBPOLY)
Cairo::CairoFC
moodycamel
xpp
- $<$:i3ipc++>
- $<$:ALSA::ALSA>
- $<$:CURL::libcurl>
- $<$:LibMPDClient::LibMPDClient>
- $<$:LibNlGenl3::LibNlGenl3>
- $<$:Libiw::Libiw>
- $<$:LibPulse::LibPulse>
- $<$:Xcb::RANDR>
- $<$:Xcb::COMPOSITE>
- $<$:Xcb::XKB>
- $<$:Xcb::CURSOR>
- $<$:Xcb::XRM>
- $<$:LibInotify::LibInotify>
)
+ if (TARGET i3ipc++)
+ target_link_libraries(poly PUBLIC i3ipc++)
+ endif()
+
+ if (TARGET ALSA::ALSA)
+ target_link_libraries(poly PUBLIC ALSA::ALSA)
+ endif()
+
+ if (TARGET CURL::libcurl)
+ target_link_libraries(poly PUBLIC CURL::libcurl)
+ endif()
+
+ if (TARGET LibMPDClient::LibMPDClient)
+ target_link_libraries(poly PUBLIC LibMPDClient::LibMPDClient)
+ endif()
+
+ if (TARGET LibNlGenl3::LibNlGenl3)
+ target_link_libraries(poly PUBLIC LibNlGenl3::LibNlGenl3)
+ endif()
+
+ if (TARGET Libiw::Libiw)
+ target_link_libraries(poly PUBLIC Libiw::Libiw)
+ endif()
+
+ if (TARGET LibPulse::LibPulse)
+ target_link_libraries(poly PUBLIC LibPulse::LibPulse)
+ endif()
+
+ if (TARGET Xcb::RANDR)
+ target_link_libraries(poly PUBLIC Xcb::RANDR)
+ endif()
+
+ if (TARGET Xcb::COMPOSITE)
+ target_link_libraries(poly PUBLIC Xcb::COMPOSITE)
+ endif()
+
+ if (TARGET Xcb::XKB)
+ target_link_libraries(poly PUBLIC Xcb::XKB)
+ endif()
+
+ if (TARGET Xcb::CURSOR)
+ target_link_libraries(poly PUBLIC Xcb::CURSOR)
+ endif()
+
+ if (TARGET Xcb::XRM)
+ target_link_libraries(poly PUBLIC Xcb::XRM)
+ endif()
+
+ if (TARGET LibInotify::LibInotify)
+ target_link_libraries(poly PUBLIC LibInotify::LibInotify)
+ endif()
+
target_compile_options(poly PUBLIC $<$:$<$:-flto>>)
set_target_properties(poly PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/libs)
# }}}