Browse Source

CMake: fix CMAKE_BUILD_TYPE and BITS check

(cherry picked from commit 165ad14b0fe39234dd257e421948c23f6571177f)
Joshua Cooper 3 years ago
parent
commit
43fae056d0
1 changed files with 8 additions and 6 deletions
  1. 8 6
      CMakeLists.txt

+ 8 - 6
CMakeLists.txt

@@ -52,7 +52,7 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${BUILD_PATH}")
 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${BUILD_PATH}")
 
 # Default build type is Debug in the SConstruct
-if(CMAKE_BUILD_TYPE STREQUAL "")
+if("${CMAKE_BUILD_TYPE}" STREQUAL "")
 	set(CMAKE_BUILD_TYPE Debug)
 endif()
 
@@ -67,6 +67,13 @@ set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
+if(NOT DEFINED BITS)
+	set(BITS 32)
+	if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+		set(BITS 64)
+	endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+endif()
+
 # Input from user for godot headers and the api file
 set(GODOT_HEADERS_DIR "godot-headers" CACHE STRING "")
 set(GODOT_CUSTOM_API_FILE "godot-headers/api.json" CACHE STRING "")
@@ -190,11 +197,6 @@ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LI
 
 # Create the correct name (godot.os.build_type.system_bits)
 
-set(BITS 32)
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-	set(BITS 64)
-endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
-
 string(TOLOWER "${CMAKE_SYSTEM_NAME}" SYSTEM_NAME)
 string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)