File: BuildType.cmake

package info (click to toggle)
innoextract 1.2%2Bgit20120504-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 752 kB
  • sloc: cpp: 7,096; python: 1,542; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 609 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

include(CompileCheck)

if(CMAKE_BUILD_TYPE STREQUAL "")
	set(CMAKE_BUILD_TYPE "Release")
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
	
	add_definitions(-DDEBUG)
	set(DEBUG 1)
	
	check_compiler_flag(RESULT "-g3")
	if(NOT RESULT STREQUAL "")
		string(REGEX REPLACE "-g(|[0-9]|gdb)" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
		set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${RESULT}")
	endif()
	
	check_compiler_flag(RESULT "-O0")
	string(REGEX REPLACE "-O[0-9]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
	set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${RESULT}")
	
endif()