1# - Set a developer-chosen default build type
2#
3# Requires these CMake modules:
4#  no additional modules required
5#
6# Original Author:
7# 2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
8# http://academic.cleardefinition.com
9# Iowa State University HCI Graduate Program/VRAC
10#
11# Copyright Iowa State University 2009-2010.
12# Distributed under the Boost Software License, Version 1.0.
13# (See accompanying file LICENSE_1_0.txt or copy at
14# http://www.boost.org/LICENSE_1_0.txt)
15#
16
17
18if(__set_default_build_type)
19	return()
20endif()
21set(__set_default_build_type YES)
22
23function(set_default_build_type _type)
24	#if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE)
25	if("${CMAKE_GENERATOR}" MATCHES "Makefiles" AND NOT CMAKE_BUILD_TYPE)
26		if(NOT __DEFAULT_BUILD_TYPE_SET)
27			set(CMAKE_BUILD_TYPE "${_type}" CACHE STRING "" FORCE)
28			set(__DEFAULT_BUILD_TYPE_SET YES CACHE INTERNAL "")
29		endif()
30	endif()
31endfunction()
32