Browse Source

Fix CMake error in case PREDEFINED_MACROS string is empty.

Lasse Öörni 11 years ago
parent
commit
f18c5dd49b
1 changed files with 5 additions and 3 deletions
  1. 5 3
      Source/CMake/Modules/Urho3D-CMake-common.cmake

+ 5 - 3
Source/CMake/Modules/Urho3D-CMake-common.cmake

@@ -42,9 +42,11 @@ set (URHO3D_DEFAULT_64BIT FALSE)
 if (NOT MSVC)
     # On non-MSVC compiler, default to build 64-bit when the host system has a 64-bit build environment
     execute_process (COMMAND echo COMMAND ${CMAKE_C_COMPILER} -E -dM - OUTPUT_VARIABLE PREDEFINED_MACROS ERROR_QUIET)
-    string (REGEX MATCH "#define +__x86_64__ +1" matched ${PREDEFINED_MACROS})
-    if (matched)
-        set (URHO3D_DEFAULT_64BIT TRUE)
+    if (NOT ${PREDEFINED_MACROS} STREQUAL "")
+        string (REGEX MATCH "#define +__x86_64__ +1" matched ${PREDEFINED_MACROS})
+        if (matched)
+            set (URHO3D_DEFAULT_64BIT TRUE)
+        endif ()
     endif ()
 endif ()
 option (URHO3D_64BIT "Enable 64-bit build" ${URHO3D_DEFAULT_64BIT})