File: EnableProfiling.cmake

package info (click to toggle)
s3d 0.2.2.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,356 kB
  • sloc: ansic: 21,128; python: 488; perl: 98; makefile: 31; sh: 29
file content (18 lines) | stat: -rw-r--r-- 558 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileCopyrightText: 2007-2015  Sven Eckelmann <sven@narfation.org>

# add option for enabling/disabling profiling
option(PROFILING "Enable/disable support for profiling with gprof" OFF)

if (PROFILING)
	include(CheckCCompilerFlag)

	# check if c compiler understands -pg
	check_c_compiler_flag("-pg" SUPPORT_PG)
	if (SUPPORT_PG)
		add_definitions("-pg")
		list(APPEND CMAKE_EXE_LINKER_FLAGS "-pg")
	else (SUPPORT_PG)
		message(FATAL_ERROR "Compiler doesn't understand -pg")
	endif (SUPPORT_PG)
endif (PROFILING)