summaryrefslogtreecommitdiffstats
path: root/cmake/SanitizeBool.cmake
blob: 586c17d05286a6fef67b1148ffb00b7e467710c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function(SanitizeBool VAR)
	string(TOLOWER "${${VAR}}" VALUE)
	if(VALUE STREQUAL "on")
		set(${VAR} "ON" PARENT_SCOPE)
	elseif(VALUE STREQUAL "yes")
		set(${VAR} "ON" PARENT_SCOPE)
	elseif(VALUE STREQUAL "true")
		set(${VAR} "ON" PARENT_SCOPE)
	elseif(VALUE STREQUAL "1")
		set(${VAR} "ON" PARENT_SCOPE)
	elseif(VALUE STREQUAL "off")
		set(${VAR} "OFF" PARENT_SCOPE)
	elseif(VALUE STREQUAL "no")
		set(${VAR} "OFF" PARENT_SCOPE)
	elseif(VALUE STREQUAL "false")
		set(${VAR} "OFF" PARENT_SCOPE)
	elseif(VALUE STREQUAL "0")
		set(${VAR} "OFF" PARENT_SCOPE)
	endif()
endfunction()