diff mbox series

[2/2] kernel-shark: Avoid debug build when CMAKE_BUILD_TYPE=Release

Message ID 20190611152043.22572-3-ykaradzhov@vmware.com (mailing list archive)
State Superseded
Headers show
Series KernelShark build fixes for v1.0 | expand

Commit Message

Yordan Karadzhov June 11, 2019, 3:20 p.m. UTC
The debug flags by design embed the build paths, but the distro package
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/CMakeLists.txt | 25 ++++++++++++++++---------
 kernel-shark/README         |  4 ++--
 2 files changed, 18 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt
index d45be20..fe398bb 100644
--- a/kernel-shark/CMakeLists.txt
+++ b/kernel-shark/CMakeLists.txt
@@ -33,8 +33,22 @@  endif (Qt5Widgets_FOUND)
 set(LIBRARY_OUTPUT_PATH    "${KS_DIR}/lib")
 set(EXECUTABLE_OUTPUT_PATH "${KS_DIR}/bin")
 
-set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -g -pthread -fPIC")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -std=c++11 -pthread -fPIC")
+set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fPIC")
+
+if (NOT CMAKE_BUILD_TYPE MATCHES Release)
+
+    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -g")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
+
+endif (NOT CMAKE_BUILD_TYPE MATCHES Release)
+
+if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
+
+    set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -O2")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
+
+endif (NOT CMAKE_BUILD_TYPE MATCHES Debug)
 
 if(NOT _INSTALL_PREFIX)
 	set(_INSTALL_PREFIX "/usr/local")
@@ -47,13 +61,6 @@  set(KS_ICON_FIN    KS_icon_fin.svg)
 set(KS_LOGO        KS_logo_symbol.svg)
 set(KS_LOGO_LABEL  KS_logo_horizontal.svg)
 
-if (NOT _DEBUG)
-
-	set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -O2")
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
-
-endif (NOT _DEBUG)
-
 SET(CMAKE_INSTALL_RPATH "${_INSTALL_PREFIX}/lib/${KS_APP_NAME}/")
 SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
 
diff --git a/kernel-shark/README b/kernel-shark/README
index 379c390..2027044 100644
--- a/kernel-shark/README
+++ b/kernel-shark/README
@@ -39,13 +39,13 @@  the original trace-cmd end traceevent libraries.
 as a CMake Command-Line option.
 
 2.1.2 In order to generates complete debug information to be used by GDB add
--D_DEBUG=1 as a CMake Command-Line option.
+-DCMAKE_BUILD_TYPE=Debug as a CMake Command-Line option.
 
 2.1.3 By default, installation prefix is "/usr/local". It can be changed using
 -D_INSTALL_PREFIX= as a CMake Command-Line option.
 
 Example:
-    cmake -D_DOXYGEN_DOC=1 -D_DEBUG=1 -D_INSTALL_PREFIX=/usr ../
+    cmake -D_DOXYGEN_DOC=1 -DCMAKE_BUILD_TYPE=Debug -D_INSTALL_PREFIX=/usr ../
 
 2.2.1 Use "make clean" if you want to delete all already compiled objects.