summaryrefslogtreecommitdiff
path: root/cmake/SanitizeBool.cmake
blob: b5b99a6904736ba751af098bf5106e6106618bf0 (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()