Skip to content

FIX: Unable to build dedicated server on VS 2022#1367

Open
Redlonghead wants to merge 1 commit intosmartcmd:mainfrom
Redlonghead:fix-dedicated-server-builds
Open

FIX: Unable to build dedicated server on VS 2022#1367
Redlonghead wants to merge 1 commit intosmartcmd:mainfrom
Redlonghead:fix-dedicated-server-builds

Conversation

@Redlonghead
Copy link

Description

Allows users to build the dedicated server with cmake version 3.24-3.31. VS 2022 is using cmake version 3.31.

Changes

Previous Behavior

When building the dedicated server with cmake versions 3.24-3.31 it would fail with the following error:

[1/5] Copying assets (files) for Minecraft.Server...
FAILED: Minecraft.Server/CMakeFiles/AssetFileCopy_Minecraft.Server-Release C:/Users/XXXX/src/MinecraftConsoles/build/windows64/Minecraft.Server/CMakeFiles/AssetFileCopy_Minecraft.Server-Release
C:\WINDOWS\system32\cmd.exe /C "cd /D C:\Users\XXXX\src\MinecraftConsoles\build\windows64\Minecraft.Server && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -DCOPY_SOURCE=C:/Users/XXXX/src/MinecraftConsoles/Minecraft.Client/Common/Media/MediaWindows64.arc -DCOPY_DEST=C:/Users/XXXX/src/MinecraftConsoles/build/windows64/Minecraft.Server/Release/Common/Media/ -P C:/Users/XXXX/src/MinecraftConsoles/cmake/CopyFileScript.cmake"
CMake Warning (dev) at C:/Users/XXXX/src/MinecraftConsoles/cmake/CopyFileScript.cmake:23 (if):
  Policy CMP0057 is not set: Support new IN_LIST if() operator.  Run "cmake
  --help-policy CMP0057" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  IN_LIST will be interpreted as an operator when the policy is set to NEW.
  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Users/XXXX/src/MinecraftConsoles/cmake/CopyFileScript.cmake:23 (if):
  if given arguments:

    "NOT" "dir" "IN_LIST" "unique_dirs"

  Unknown arguments specified

Root Cause

In file cmake/CopyFileScript.cmake on line 22 the IF statement uses a new operator "IN_LIST" with out specifying the minimum version for cmake. The latest versions of cmake (4.0+) removed this policy to default to NEW while version 3.31 used in VS would still default to OLD.

New Behavior

You can build the dedicated server on cmake version 3.24-3.31.

Fix Implementation

Added cmake_minimum_required(VERSION 3.24) to file cmake/CopyFileScript.cmake.

AI Use Disclosure

No AI was used.

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant