@@ -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)
@@ -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.
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(-)