@@ -218,6 +218,27 @@ def patchScaleUntrimCMake(cmake_path):
218218 print ("Patched ScaleUntrim/CMakeLists.txt for cross-architecture OpenCASCADE detection." )
219219
220220
221+ def patchLemonCMake (cmake_path ):
222+ """
223+ Patch lemon's CMakeLists.txt to remove the explicit cmake_policy(SET CMP0048 OLD)
224+ call, which newer CMake versions no longer allow.
225+ """
226+ with open (cmake_path , "r" ) as f :
227+ content = f .read ()
228+
229+ patched = content .replace (
230+ "cmake_policy(SET CMP0048 OLD)" ,
231+ "cmake_policy(SET CMP0048 NEW)"
232+ )
233+ if patched == content :
234+ print ("lemon CMakeLists.txt already patched or pattern not found, skipping." )
235+ return
236+
237+ with open (cmake_path , "w" ) as f :
238+ f .write (patched )
239+ print ("Patched lemon CMakeLists.txt: CMP0048 OLD -> NEW." )
240+
241+
221242def buildScaleUntrim ():
222243 os = findOS ()
223244 manager = findPackageManager (os )
@@ -234,6 +255,7 @@ def buildScaleUntrim():
234255 installLibraries (manager , ["eigen" , "boost" , "OpenCascade" ])
235256 cloneRepository ("https://github.com/colbyj427/edited-scale-untrim.git" , "ScaleUntrim" )
236257 patchScaleUntrimCMake ("ScaleUntrim/CMakeLists.txt" )
258+ patchLemonCMake ("ScaleUntrim/3rd/lemon-1.3.1/CMakeLists.txt" )
237259 makeDirectory ("ScaleUntrim/build" )
238260 if os == "darwin" :
239261 sdkroot = subprocess .check_output (["xcrun" , "--sdk" , "macosx" , "--show-sdk-path" ], text = True ).strip ()
@@ -249,7 +271,9 @@ def buildScaleUntrim():
249271 ]
250272 else :
251273 cmake_cmd = ["cmake" , "-B" , "ScaleUntrim/build" , "-S" , "ScaleUntrim" ,
252- "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" ]
274+ "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" ,
275+ "-DCMAKE_C_COMPILER=gcc" ,
276+ "-DCMAKE_CXX_COMPILER=g++" ]
253277 runCommand (cmake_cmd )
254278 runCommand (["make" , "-C" , "ScaleUntrim/build" , f"-j{ __import__ ('os' ).cpu_count ()} " ])
255279 makeDirectory ("ScaleUntrim/build/tempDir" )
0 commit comments