Use cmake options to specify build type and debug output so that CMakeList.txt needs not be modified to control this

This commit is contained in:
f4exb 2015-10-22 02:19:07 +02:00
parent af58b0d48d
commit 91cab6c623
2 changed files with 30 additions and 5 deletions

View File

@ -3,14 +3,22 @@ cmake_policy(SET CMP0043 OLD)
option(V4L-RTL "Use Linux Kernel RTL-SDR Source." OFF)
option(V4L-MSI "Use Linux Kernel MSI2500 Source." OFF)
option(BUILD_TYPE "Build type (RELEASE, RELEASEWITHDBGINFO, DEBUG" RELEASE)
option(DEBUG_OUTPUT "Print debug messages" OFF)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
project(sdrangel)
set(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo")
#set(CMAKE_BUILD_TYPE "Debug")
if (BUILD_TYPE MATCHES RELEASE)
set(CMAKE_BUILD_TYPE "Release")
elseif (BUILD_TYPE MATCHES RELEASEWITHDBGINFO)
set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo")
elseif (BUILD_TYPE MATCHES DEBUG)
set(CMAKE_BUILD_TYPE "Debug")
else()
set(CMAKE_BUILD_TYPE "Release")
endif()
set(QT_USE_QTOPENGL TRUE)
set(CMAKE_AUTOMOC ON)
@ -33,8 +41,13 @@ ENDIF()
##############################################################################
#include(${QT_USE_FILE})
set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" )
#set( QT_DEFINITIONS "${QT_DEFINITIONS}" )
if (DEBUG_OUTPUT)
set( QT_DEFINITIONS "${QT_DEFINITIONS}" )
else()
set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" )
endif()
add_definitions(${QT_DEFINITIONS})
if(MSVC)

View File

@ -201,3 +201,15 @@ For Debian Jessie or Stretch:
- Enhance WFM (stereo, RDS?)
- Even more demods ...
<h1>Developper's notes</h1>
<h2>Build options</h2>
The release type can be specified with the `-DBUILD_TYPE` cmake option. It takes the following values:
- `RELEASE` (default): produces production release code i.e.optimized and no debug symbols
- `RELEASEWITHDBGINFO`: optimized with debug info
- `DEBUG`: unoptimized with debug info
You can specify whether or not you want to see debug messages printed out to the console with the `-DDEBUG_OUTPUT` cmake option:
- `OFF` (default): no debug output
- `ON`: debug output