From 5a05d4ff53290f53cc17632417ebf95c521e41e1 Mon Sep 17 00:00:00 2001 From: n-morales <61885661+n-morales@users.noreply.github.com> Date: Sun, 10 Nov 2024 19:36:24 -0500 Subject: [PATCH] Bump cmake version to 3.27 and fix headless linking to GLEW (#1762) * fix source file names in cmake * bump cmake version to 3.27 * make lua link GLEW compile-only, preventing linking to the actual lib --- AI/Wrappers/LegacyCpp/CMakeLists.txt | 20 ++++++++++---------- CMakeLists.txt | 2 +- rts/build/cmake/ConfigureVersion.cmake | 2 +- rts/lib/lua/CMakeLists.txt | 2 +- rts/lib/minizip/CMakeLists.txt | 6 +++--- tools/dirchange/CMakeLists.txt | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/AI/Wrappers/LegacyCpp/CMakeLists.txt b/AI/Wrappers/LegacyCpp/CMakeLists.txt index 82c48ebf8e..eed151f24f 100644 --- a/AI/Wrappers/LegacyCpp/CMakeLists.txt +++ b/AI/Wrappers/LegacyCpp/CMakeLists.txt @@ -44,16 +44,16 @@ if (BUILD_${myName}_AIWRAPPER) # Assemble the Legacy C++ AI sources set(mySources - "${mySourceDir}/AIAI" - "${mySourceDir}/AIAICallback" - "${mySourceDir}/AIAICheats" - "${mySourceDir}/AIGlobalAICallback" - "${mySourceDir}/DamageArray" - "${mySourceDir}/MoveData" - "${mySourceDir}/UnitDef" - "${rts}/ExternalAI/AISCommands" - "${rts}/Sim/Units/CommandAI/Command" - "${rts}/System/float3" + "${mySourceDir}/AIAI.cpp" + "${mySourceDir}/AIAICallback.cpp" + "${mySourceDir}/AIAICheats.cpp" + "${mySourceDir}/AIGlobalAICallback.cpp" + "${mySourceDir}/DamageArray.cpp" + "${mySourceDir}/MoveData.cpp" + "${mySourceDir}/UnitDef.cpp" + "${rts}/ExternalAI/AISCommands.cpp" + "${rts}/Sim/Units/CommandAI/Command.cpp" + "${rts}/System/float3.cpp" ${ai_common_SRC} ) diff --git a/CMakeLists.txt b/CMakeLists.txt index b28c7cce88..e934a3c004 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.27) cmake_policy(SET CMP0060 OLD) #causes link errors on Linux otherwise cmake_policy(SET CMP0065 OLD) #we need binaries compiled with -rdynamic for BARb to work (cause unknown https://github.com/beyond-all-reason/spring/issues/405) diff --git a/rts/build/cmake/ConfigureVersion.cmake b/rts/build/cmake/ConfigureVersion.cmake index 92912a6665..8928dc5752 100644 --- a/rts/build/cmake/ConfigureVersion.cmake +++ b/rts/build/cmake/ConfigureVersion.cmake @@ -16,7 +16,7 @@ # ) # -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 3.27) list(APPEND CMAKE_MODULE_PATH "${CMAKE_MODULES_SPRING}") diff --git a/rts/lib/lua/CMakeLists.txt b/rts/lib/lua/CMakeLists.txt index ca2905901a..090ff9b1b7 100644 --- a/rts/lib/lua/CMakeLists.txt +++ b/rts/lib/lua/CMakeLists.txt @@ -48,7 +48,7 @@ else () TARGET_LINK_LIBRARIES(lua) endif () -target_link_libraries(lua GLEW::GLEW) +target_link_libraries(lua $) target_include_directories(lua PUBLIC include) if (UNIX) diff --git a/rts/lib/minizip/CMakeLists.txt b/rts/lib/minizip/CMakeLists.txt index 1cc13e2fd9..3974dc4a8f 100644 --- a/rts/lib/minizip/CMakeLists.txt +++ b/rts/lib/minizip/CMakeLists.txt @@ -13,9 +13,9 @@ else (MINIZIP_FOUND) # Build our own minizip library set(miniZipSources - "unzip" - "zip" - "ioapi" + "unzip.c" + "zip.c" + "ioapi.c" ) add_definitions(-DNOCRYPT -DNOUNCRYPT) diff --git a/tools/dirchange/CMakeLists.txt b/tools/dirchange/CMakeLists.txt index d338e78026..ed5ae73f21 100644 --- a/tools/dirchange/CMakeLists.txt +++ b/tools/dirchange/CMakeLists.txt @@ -7,5 +7,5 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") -add_executable(dirchange EXCLUDE_FROM_ALL dirchange) +add_executable(dirchange EXCLUDE_FROM_ALL dirchange.cpp) set_target_properties(dirchange PROPERTIES OUTPUT_NAME "dch")