cmake: fix setting CMAKE_BUILD_TYPE default

this needs to be a forced cache variable in the case it doesn't exist

Change-Id: I6b20a93798a5f0ef472170d5892545d21acc7c43
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bcd0d8e..604642e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,8 +11,9 @@
 cmake_minimum_required(VERSION 3.5)
 
 if (NOT EMSCRIPTEN)
-  if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
-    set(CMAKE_BUILD_TYPE "RelWithDebInfo")
+  if (NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE
+      "Build type: Debug, Release, RelWithDebInfo or MinSizeRel" STRING FORCE)
   endif ()
 endif ()