@@ -12,10 +12,14 @@
# MESSAGE(" Looking for trace-cmd ...")
# First search in the user provided paths.
-find_path(TRACECMD_BIN_DIR NAMES trace-cmd
- PATHS $ENV{TRACE_CMD}/tracecmd/
- ${CMAKE_SOURCE_DIR}/../tracecmd/
- NO_DEFAULT_PATH)
+if (CMAKE_BUILD_TYPE MATCHES Debug)
+
+ find_program(TRACECMD_EXECUTABLE NAMES trace-cmd
+ PATHS $ENV{TRACE_CMD}/tracecmd/
+ ${CMAKE_SOURCE_DIR}/../tracecmd/
+ NO_DEFAULT_PATH)
+
+endif (CMAKE_BUILD_TYPE MATCHES Debug)
find_path(TRACECMD_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h
PATHS $ENV{TRACE_CMD}/include/
@@ -34,16 +38,16 @@ find_library(TRACEEVENT_LIBRARY NAMES traceevent/libtraceevent.a
# If not found, search in the default system paths. Note that if the previous
# search was successful "find_path" will do nothing this time.
-find_path(TRACECMD_BIN_DIR NAMES trace-cmd)
+find_program(TRACECMD_EXECUTABLE NAMES trace-cmd)
find_path(TRACECMD_INCLUDE_DIR NAMES trace-cmd/trace-cmd.h)
find_library(TRACECMD_LIBRARY NAMES trace-cmd/libtracecmd.so)
find_library(TRACEEVENT_LIBRARY NAMES traceevent/libtraceevent.so)
-IF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY)
+IF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY AND TRACECMD_EXECUTABLE)
SET(TRACECMD_FOUND TRUE)
-ENDIF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY)
+ENDIF (TRACECMD_INCLUDE_DIR AND TRACECMD_LIBRARY AND TRACECMD_EXECUTABLE)
IF (TRACECMD_FOUND)
@@ -18,7 +18,7 @@
#cmakedefine KS_PLUGIN_INSTALL_PREFIX "@KS_PLUGIN_INSTALL_PREFIX@"
/** Location of the trace-cmd executable. */
-#cmakedefine TRACECMD_BIN_DIR "@TRACECMD_BIN_DIR@"
+#cmakedefine TRACECMD_EXECUTABLE "@TRACECMD_EXECUTABLE@"
/** "pkexec" executable. */
#cmakedefine DO_AS_ROOT "@DO_AS_ROOT@"
@@ -489,12 +489,11 @@ KsCaptureDialog::KsCaptureDialog(QWidget *parent)
connect(&_captureCtrl._closeButton, &QPushButton::pressed,
this, &KsCaptureDialog::close);
- if (KsUtils::isInstalled())
- captureExe = QString(_INSTALL_PREFIX) + QString("/bin");
+ if (!KsUtils::isInstalled())
+ captureExe = QString(_INSTALL_PREFIX) + QString("/bin/trace-cmd");
else
- captureExe = TRACECMD_BIN_DIR;
+ captureExe = TRACECMD_EXECUTABLE;
- captureExe += "/trace-cmd";
_captureProc.setProgram(captureExe);
_captureMon.connectMe(&_captureProc, &_captureCtrl);
The full path to the build directory (which is random for every user) is embedded in the final binary. This is a no-no for some Linux distros which are requiring that the finished binaries should not have such paths embedded in them. Reported-by: Troy Engel <troyengel@gmail.com> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> --- kernel-shark/build/FindTraceCmd.cmake | 18 +++++++++++------- kernel-shark/build/deff.h.cmake | 2 +- kernel-shark/src/KsCaptureDialog.cpp | 7 +++---- 3 files changed, 15 insertions(+), 12 deletions(-)