From 28bc4b338feb883ea20fbb7448942d954d12edb9 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Tue, 21 May 2024 19:59:41 -0600 Subject: [PATCH] Fix cmake on msvc --- CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ac7c3a7..c659a485 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,21 @@ set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "YOUR_TEAM_ID") set(PROJECT_ID "dev.net64.game") endif() +################################################################################ +# Set target arch type if empty. Visual studio solution generator provides it. +################################################################################ +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if(NOT CMAKE_VS_PLATFORM_NAME) + set(CMAKE_VS_PLATFORM_NAME "x64") + endif() + message("${CMAKE_VS_PLATFORM_NAME} architecture in use") + + if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64" + OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")) + message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!") + endif() +endif() + # Set game compilation version set(VERSION us) set(USE_NETWORKING OFF)