Automatically detect architecture based on Visual Studio generator

DFHACK_BUILD_ARCH is no longer cached on Windows since it is not possible
to build Win32 targets with the Win64 generator or vice versa. No change
for GCC builds.
develop
Carter Bray 2016-07-31 17:01:47 -07:00
parent 60cf860450
commit 625fbbec1d
1 changed files with 11 additions and 1 deletions

@ -67,7 +67,17 @@ add_definitions ( "/D_CRT_NONSTDC_NO_WARNINGS")
add_definitions( "/wd4503") add_definitions( "/wd4503")
endif() endif()
SET(DFHACK_BUILD_ARCH "32" CACHE STRING "Architecture to build ('32' or '64')") # Automatically detect architecture based on Visual Studio generator
IF(MSVC AND NOT DEFINED DFHACK_BUILD_ARCH)
IF(${CMAKE_GENERATOR} MATCHES "Win64")
SET(DFHACK_BUILD_ARCH "64")
ELSE()
SET(DFHACK_BUILD_ARCH "32")
ENDIF()
ELSE()
SET(DFHACK_BUILD_ARCH "32" CACHE STRING "Architecture to build ('32' or '64')")
ENDIF()
IF("${DFHACK_BUILD_ARCH}" STREQUAL "32") IF("${DFHACK_BUILD_ARCH}" STREQUAL "32")
SET(DFHACK_BUILD_32 1) SET(DFHACK_BUILD_32 1)
SET(DFHACK_BUILD_64 0) SET(DFHACK_BUILD_64 0)