summaryrefslogtreecommitdiffstats
path: root/cmake/SanitizeBool.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:47:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:47:08 +0000
commit29b5ab554790bb57337a3b6ab9dcd963cf69d22e (patch)
treebe1456d2bc6c1fb078695fad7bc8f6b212062d3c /cmake/SanitizeBool.cmake
parentInitial commit. (diff)
downloadlibgit2-29b5ab554790bb57337a3b6ab9dcd963cf69d22e.tar.xz
libgit2-29b5ab554790bb57337a3b6ab9dcd963cf69d22e.zip
Adding upstream version 1.7.2+ds.upstream/1.7.2+ds
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/SanitizeBool.cmake')
-rw-r--r--cmake/SanitizeBool.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmake/SanitizeBool.cmake b/cmake/SanitizeBool.cmake
new file mode 100644
index 0000000..586c17d
--- /dev/null
+++ b/cmake/SanitizeBool.cmake
@@ -0,0 +1,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()