Browse Source

Allow to enable debug output in release builds

coverity_scan
Daniel Scharrer 13 years ago
parent
commit
e2ee3b8d85
  1. 9
      CMakeLists.txt
  2. 20
      README.md
  3. 4
      cmake/BuildType.cmake

9
CMakeLists.txt

@ -10,6 +10,15 @@ option(DEBUG_EXTRA "Expensive debug options" OFF)
option(SET_WARNING_FLAGS "Adjust compiler warning flags" ON)
option(SET_OPTIMIZATION_FLAGS "Adjust compiler optimization flags" ON)
option(USE_CXX11 "Try to use C++11 if available" ON)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(IS_DEBUG_BUILD ON)
else()
set(IS_DEBUG_BUILD OFF)
endif()
option(DEBUG "Enable debug output and runtime checks" ${IS_DEBUG_BUILD})
if(DEBUG)
add_definitions(-DDEBUG=1)
endif()
set(default_USE_STATIC_LIBS OFF)
if(WIN32)

20
README.md

@ -44,18 +44,20 @@ Build options:
|:------------------------ |:---------:|:----------- |
| `USE_LZMA` | `ON` | Use `liblzma` if available.
| `CMAKE_BUILD_TYPE` | `Release` | Set to `Debug` to enable debug output.
| `DEBUG` | `OFF`^1 | Enable debug output and runtime checks.
| `DEBUG_EXTRA` | `OFF` | Expensive debug options.
| `SET_WARNING_FLAGS` | `ON` | Adjust compiler warning flags. This should not affect the produced binaries but is useful to catch potential problems.
| `SET_OPTIMIZATION_FLAGS` | `ON` | Adjust compiler optimization flags. For non-debug builds the only thing this does is instruct the linker to only link against libraries that are actually needed.
| `USE_CXX11` | `ON` | Try to compile in C++11 mode if available.
| `DEBUG_EXTRA` | `OFF` | Expensive debug options.
| `USE_STATIC_LIBS` | `OFF`^1 | Turns on static linking for all libraries, including `-static-libgcc` and `-static-libstdc++`. You can also use the individual options below:
| `LZMA_USE_STATIC_LIBS` | `OFF`^2 | Statically link `liblzma`.
| `Boost_USE_STATIC_LIBS` | `OFF`^2 | Statically link Boost. See also `FindBoost.cmake`
| `ZLIB_USE_STATIC_LIBS` | `OFF`^2 | Statically link `libz`. (used via Boost)
| `BZip2_USE_STATIC_LIBS` | `OFF`^2 | Statically link `libbz2`. (used via Boost)
| `iconv_USE_STATIC_LIBS` | `OFF`^2 | Statically link `libiconv`.
1. Under Windows, the default is `ON`.
2. Default is `ON` if `USE_STATIC_LIBS` is enabled.
| `USE_STATIC_LIBS` | `OFF`^2 | Turns on static linking for all libraries, including `-static-libgcc` and `-static-libstdc++`. You can also use the individual options below:
| `LZMA_USE_STATIC_LIBS` | `OFF`^3 | Statically link `liblzma`.
| `Boost_USE_STATIC_LIBS` | `OFF`^3 | Statically link Boost. See also `FindBoost.cmake`
| `ZLIB_USE_STATIC_LIBS` | `OFF`^3 | Statically link `libz`. (used via Boost)
| `BZip2_USE_STATIC_LIBS` | `OFF`^3 | Statically link `libbz2`. (used via Boost)
| `iconv_USE_STATIC_LIBS` | `OFF`^3 | Statically link `libiconv`.
1. Enabled automatically if `CMAKE_BUILD_TYPE` is set to `Debug`.
2. Under Windows, the default is `ON`.
3. Default is `ON` if `USE_STATIC_LIBS` is enabled.
Install options:

4
cmake/BuildType.cmake

@ -8,10 +8,6 @@ option(SET_OPTIMIZATION_FLAGS "Adjust compiler optimization flags" ON)
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DDEBUG)
set(DEBUG 1)
endif()
if(MSVC)

Loading…
Cancel
Save