From ff9a12232643e9b29317e65eb64ab8e2f0974b70 Mon Sep 17 00:00:00 2001 From: voidanix <51296985+voidanix@users.noreply.github.com> Date: Thu, 20 Apr 2023 21:15:34 +0200 Subject: [PATCH] cmake: Require OpenGL for clients only When building the server only, CMake would yell that OpenGL is required even if totally unnecessary: move the OpenGL requirement inside BUILD_CLIENT where it should belong. --- src/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 27f13a14..a107c3d5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,18 +65,18 @@ set(BUILD_GENKEY ON CACHE STRING "Build genkey") # this allows for easier cross-compiling with MinGW, as we can use the precompiled libraries find_package(ZLIB REQUIRED) +# OpenGL may be imported with pkg-config on Unix, but that doesn't work on macOS +set(OpenGL_GL_PREFERENCE LEGACY) + # for SDL2* we need to ship custom configs list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) if(BUILD_CLIENT) find_package(SDL2 REQUIRED) find_package(SDL2_image REQUIRED) find_package(SDL2_mixer REQUIRED) + find_package(OpenGL REQUIRED) endif() -# OpenGL may be imported with pkg-config on Unix, but that doesn't work on macOS -set(OpenGL_GL_PREFERENCE LEGACY) -find_package(OpenGL REQUIRED) - # import enet # note that we have to include this before setting CMAKE_EXECUTABLE_SUFFIX # otherwise, enet's platform tests fail with cryptic error messages