From 209f346d55eeaf74e21c541d70ec43d39b6c8c3c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 27 May 2023 17:22:10 -0700
Subject: [PATCH] cmake: Allow SYSTEMCTL_BIN to be overridden from environment

This allows to encode correct paths which are inside the target rootfs
for systemctl

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 98985e7ee..001efb800 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,7 +256,10 @@ else()
     message(WARNING "pyverbs build requested but python development files not found")
 endif()
 
-find_program(SYSTEMCTL_BIN systemctl HINTS "/usr/bin" "/bin")
+if (NOT SYSTEMCTL_BIN)
+  find_program(SYSTEMCTL_BIN systemctl HINTS "/usr/bin" "/bin")
+endif()
+
 if (NOT SYSTEMCTL_BIN)
   set (SYSTEMCTL_BIN "/bin/systemctl")
 endif()
