Skip to content

Commit 6456933

Browse files
committed
Patch cmake_minimum_version to meet current cmake requirements
Support for cmake < 3.5 has been dropped in recent upstream versions.
1 parent 5ff15e3 commit 6456933

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index fb666391..19cb9344 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -1,18 +1,9 @@
6+
-cmake_minimum_required(VERSION 2.8)
7+
-
8+
-set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
9+
+cmake_minimum_required(VERSION 3.5)
10+
+cmake_policy(VERSION 3.5...4.1.1)
11+
12+
PROJECT(madX C CXX Fortran)
13+
14+
-cmake_policy(VERSION 2.8...3.18)
15+
-if (NOT ${CMAKE_VERSION} VERSION_LESS 3.0)
16+
- cmake_policy(SET CMP0042 NEW)
17+
-endif()
18+
-
19+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
20+
-if(CMAKE_VERSION VERSION_LESS "2.8.3")
21+
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/compilers")
22+
-endif()
23+
24+
include(madxInit)
25+
include(setupOptions)
26+
diff --git a/libs/gc/gc-8.0.2/CMakeLists.txt b/libs/gc/gc-8.0.2/CMakeLists.txt
27+
index f588fc16..f1ecccec 100644
28+
--- a/libs/gc/gc-8.0.2/CMakeLists.txt
29+
+++ b/libs/gc/gc-8.0.2/CMakeLists.txt
30+
@@ -27,7 +27,7 @@ PROJECT(gc)
31+
32+
INCLUDE(CTest)
33+
34+
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
35+
+CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
36+
37+
ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE
38+
-DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION")
39+
diff --git a/libs/ptc/CMakeLists.txt b/libs/ptc/CMakeLists.txt
40+
index 0c576c92..da21a0e2 100644
41+
--- a/libs/ptc/CMakeLists.txt
42+
+++ b/libs/ptc/CMakeLists.txt
43+
@@ -1,4 +1,4 @@
44+
-cmake_minimum_required(VERSION 2.6)
45+
+cmake_minimum_required(VERSION 3.5)
46+
47+
# Some policies regarding configure
48+
# warnings we do not want..
49+
diff --git a/tools/numdiff/CMakeLists.txt b/tools/numdiff/CMakeLists.txt
50+
index 0c622de1..f6681ef1 100644
51+
--- a/tools/numdiff/CMakeLists.txt
52+
+++ b/tools/numdiff/CMakeLists.txt
53+
@@ -1,4 +1,4 @@
54+
-cmake_minimum_required(VERSION 2.4)
55+
+cmake_minimum_required(VERSION 3.5)
56+
57+
project(ndiff C)
58+

.github/workflows/build.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ jobs:
4343
src/MAD-X -b $MADX_VERSION --depth 1
4444
if: steps.madx-build-cache.outputs.cache-hit != 'true'
4545

46+
- name: "Apply patch: cmake_minimum_version.patch"
47+
if: steps.madx-build-cache.outputs.cache-hit != 'true'
48+
run: git -C src/MAD-X apply - <.github/patch/cmake_minimum_version.patch
49+
4650
- name: Set up QEMU for running arm64 containers
4751
if: endsWith(matrix.base, '_aarch64')
4852
uses: docker/setup-qemu-action@v3
@@ -118,9 +122,12 @@ jobs:
118122
src/MAD-X -b $MADX_VERSION --depth 1
119123
if: steps.madx-build-cache.outputs.cache-hit != 'true'
120124

121-
- name: Apply patches
125+
- name: "Apply patch: fix-madx-win32.patch"
122126
if: steps.madx-build-cache.outputs.cache-hit != 'true'
123127
run: git -C src/MAD-X apply - <.github/patch/fix-madx-win32.patch
128+
- name: "Apply patch: cmake_minimum_version.patch"
129+
if: steps.madx-build-cache.outputs.cache-hit != 'true'
130+
run: git -C src/MAD-X apply - <.github/patch/cmake_minimum_version.patch
124131
- name: Build MAD-X
125132
if: steps.madx-build-cache.outputs.cache-hit != 'true'
126133
run: .github/build/windows/madx.sh src/MAD-X
@@ -191,6 +198,10 @@ jobs:
191198
src/MAD-X -b $MADX_VERSION --depth 1
192199
if: steps.madx-build-cache.outputs.cache-hit != 'true'
193200

201+
- name: "Apply patch: cmake_minimum_version.patch"
202+
if: steps.madx-build-cache.outputs.cache-hit != 'true'
203+
run: git -C src/MAD-X apply - <.github/patch/cmake_minimum_version.patch
204+
194205
# Select matching Xcode and SDK, see: https://xcodereleases.com/
195206
- run: |
196207
sudo xcode-select -switch /Applications/Xcode_15.2.app

0 commit comments

Comments
 (0)