diff mbox series

[1/4] kernel-shark: Allow specifying PKG_CONFIG_DIR on cmake command line

Message ID 20210317164101.30848-2-michal.sojka@cvut.cz (mailing list archive)
State Accepted
Commit 9fbb7a6a731a1fdff5aabacb9e6d2e0bf04aa5e9
Headers show
Series kernel-shark: CMake changes | expand

Commit Message

Michal Sojka March 17, 2021, 4:40 p.m. UTC
On some distributions (e.g. NixOS), it is not possible to write files
to directories owned by different packages. For this reason, we cannot
always install libkshark.pc file to the directory reported by
pkg-config.

This commit allows to specify where to install the .pc file on cmake
commandline via -DPKG_CONGIG_DIR=... When specified, automatic
detection of .pc install directory is skipped.

Signed-off-by: Michal Sojka <michal.sojka@cvut.cz>
---
 src/CMakeLists.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1e86e9c..b81d7d9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -134,8 +134,10 @@  if (Qt5Widgets_FOUND AND Qt5Network_FOUND AND TT_FONT_FILE)
             DESTINATION ${_INSTALL_PREFIX}/bin/
                 COMPONENT                 kernelshark)
 
-    execute_process(COMMAND  bash "-c" "pkg-config --variable pc_path pkg-config | cut -f 1 -d: -z"
-                    OUTPUT_VARIABLE PKG_CONGIG_DIR)
+    if (NOT PKG_CONGIG_DIR)
+        execute_process(COMMAND  bash "-c" "pkg-config --variable pc_path pkg-config | cut -f 1 -d: -z"
+          OUTPUT_VARIABLE PKG_CONGIG_DIR)
+    endif (NOT PKG_CONGIG_DIR)
     install(FILES "${KS_DIR}/libkshark.pc"
             DESTINATION ${PKG_CONGIG_DIR}
                 COMPONENT                 libkshark-devel)