From 5d20d85c26c87616fffd95882119239b24b35c7f Mon Sep 17 00:00:00 2001 From: Matt Dawkins Date: Sat, 24 Jan 2026 13:02:36 -0500 Subject: [PATCH 1/6] Update minimum CMake version to 3.10 in core files - Update cmake_minimum_required from 3.3.0 to 3.10 in root CMakeLists.txt - Add CMAKE_POLICY_VERSION_MINIMUM=3.10 to COMMON_CMAKE_ARGS - Add Windows-specific CMP0091 policy for MSVC runtime library - Update Patches/Boost/Common.cmake to require CMake 3.10 These changes prepare fletch for CMake 4 compatibility. Co-Authored-By: Claude Opus 4.5 --- CMakeLists.txt | 10 +++++++++- Patches/Boost/Common.cmake | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a55fdc44..59e54fe1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.3.0) +cmake_minimum_required(VERSION 3.10) project(fletch) # Policy to address @foo@ variable expansion @@ -365,6 +365,7 @@ set (COMMON_CMAKE_ARGS "-DCMAKE_CONFIGURATION_TYPES:STRING=${CMAKE_SS_CONF_TYPES}" -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} -DCMAKE_POLICY_DEFAULT_CMP0042=NEW + -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DCMAKE_INSTALL_LIBDIR:PATH=lib @@ -378,6 +379,13 @@ set (COMMON_CMAKE_ARGS -DCUDAToolkit_NVCC_EXECUTABLE=${CUDA_NVCC_EXECUTABLE} ) +if (WIN32) + list(APPEND COMMON_CMAKE_ARGS + -DCMAKE_POLICY_DEFAULT_CMP0091=NEW + -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL + ) +endif() + # # Set up fletch targets # diff --git a/Patches/Boost/Common.cmake b/Patches/Boost/Common.cmake index ad144c00..0be647fa 100644 --- a/Patches/Boost/Common.cmake +++ b/Patches/Boost/Common.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.3.0) +cmake_minimum_required(VERSION 3.10) # Retrieve the list of CMAKE variables include("${CMAKE_VARS_FILE}") From b02b50afe73d791cd43cd83da439d522a4d4803f Mon Sep 17 00:00:00 2001 From: Matt Dawkins Date: Sat, 24 Jan 2026 13:02:42 -0500 Subject: [PATCH 2/6] Update minimum CMake version in library patch files - Patches/CppDB/CMakeLists.txt: 2.6 -> 3.10 - Patches/PostgreSQL/CMakeLists.txt: 2.8 -> 3.10 - Patches/PostgreSQL/Patch.cmake: Add cmake_minimum_required to generated file - Patches/libsvm/CMakeLists.txt: 3.3 -> 3.16.0 Co-Authored-By: Claude Opus 4.5 --- Patches/CppDB/CMakeLists.txt | 2 +- Patches/PostgreSQL/CMakeLists.txt | 2 +- Patches/PostgreSQL/Patch.cmake | 2 ++ Patches/libsvm/CMakeLists.txt | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Patches/CppDB/CMakeLists.txt b/Patches/CppDB/CMakeLists.txt index 65ebab66..6ab3e4b7 100644 --- a/Patches/CppDB/CMakeLists.txt +++ b/Patches/CppDB/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 3.10) project(cppdb) set(CPPDB_MAJOR 0) diff --git a/Patches/PostgreSQL/CMakeLists.txt b/Patches/PostgreSQL/CMakeLists.txt index 1756b7b4..027019fd 100644 --- a/Patches/PostgreSQL/CMakeLists.txt +++ b/Patches/PostgreSQL/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.10) project(pq) set(postgresql_SOURCE_DIR ${pq_SOURCE_DIR}/../../..) diff --git a/Patches/PostgreSQL/Patch.cmake b/Patches/PostgreSQL/Patch.cmake index 08cb24d5..6631cb5e 100644 --- a/Patches/PostgreSQL/Patch.cmake +++ b/Patches/PostgreSQL/Patch.cmake @@ -12,6 +12,8 @@ if(WIN32) file(WRITE ${PostgreSQL_source}/CMakeLists.txt " +cmake_minimum_required(VERSION 3.10) +project(PostgreSQL) add_subdirectory(src) ") file(WRITE ${PostgreSQL_source}/src/CMakeLists.txt " diff --git a/Patches/libsvm/CMakeLists.txt b/Patches/libsvm/CMakeLists.txt index d7aebe63..59a2d5a2 100644 --- a/Patches/libsvm/CMakeLists.txt +++ b/Patches/libsvm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.3) +cmake_minimum_required(VERSION 3.16.0) project(libsvm VERSION 3.11 LANGUAGES CXX) # Build shared library from svm.cpp From 63f081423cba21a8c23ace288c31ca24c2609791 Mon Sep 17 00:00:00 2001 From: Matt Dawkins Date: Sat, 24 Jan 2026 13:02:48 -0500 Subject: [PATCH 3/6] Add VTK CMake 4 compatibility patches Add patches for VTK 8.0, 8.2, 9.0, and 9.5 to fix CMake 4 compatibility. The main issue is that cmake_policy(SET CMP0022 OLD) is no longer supported in CMake 4. These patches replace the vtklibproj4 policies.cmake file to set CMP0022 to NEW instead. Co-Authored-By: Claude Opus 4.5 --- Patches/VTK/8.0/Patch.cmake | 5 +++++ .../ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake | 6 ++++++ Patches/VTK/8.2/Patch.cmake | 5 +++++ .../ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake | 6 ++++++ Patches/VTK/9.0/Patch.cmake | 5 +++++ .../ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake | 6 ++++++ Patches/VTK/9.5/Patch.cmake | 9 +++++++++ .../ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake | 6 ++++++ 8 files changed, 48 insertions(+) create mode 100644 Patches/VTK/8.0/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake create mode 100644 Patches/VTK/8.2/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake create mode 100644 Patches/VTK/9.0/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake create mode 100644 Patches/VTK/9.5/Patch.cmake create mode 100644 Patches/VTK/9.5/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake diff --git a/Patches/VTK/8.0/Patch.cmake b/Patches/VTK/8.0/Patch.cmake index 64bf2951..5db6f45a 100644 --- a/Patches/VTK/8.0/Patch.cmake +++ b/Patches/VTK/8.0/Patch.cmake @@ -40,3 +40,8 @@ file(COPY ${VTK_PATCH_DIR}/Wrapping/PythonCore/vtkPythonArgs.cxx file(COPY ${VTK_PATCH_DIR}/CMake/VTKGenerateExportHeader.cmake DESTINATION ${VTK_SOURCE_DIR}/CMake/ ) + +# Fix for CMake 4 compatibility - CMP0022 policy cannot be set to OLD +file(COPY ${VTK_PATCH_DIR}/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake + DESTINATION ${VTK_SOURCE_DIR}/ThirdParty/libproj4/vtklibproj4/cmake/ +) diff --git a/Patches/VTK/8.0/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake b/Patches/VTK/8.0/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake new file mode 100644 index 00000000..a40ec25a --- /dev/null +++ b/Patches/VTK/8.0/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake @@ -0,0 +1,6 @@ +# Policies patched for CMake 4 compatibility +# CMP0022: INTERFACE_LINK_LIBRARIES defines the link interface +# CMake 4 no longer supports setting this to OLD, so we set it to NEW +if(POLICY CMP0022) + cmake_policy(SET CMP0022 NEW) +endif() diff --git a/Patches/VTK/8.2/Patch.cmake b/Patches/VTK/8.2/Patch.cmake index 30a8c90c..20b6a109 100644 --- a/Patches/VTK/8.2/Patch.cmake +++ b/Patches/VTK/8.2/Patch.cmake @@ -26,3 +26,8 @@ file(COPY ${VTK_PATCH_DIR}/ThirdParty/exodusII/vtkexodusII/src/ex_open_par.c file(COPY ${VTK_PATCH_DIR}/CMake/VTKGenerateExportHeader.cmake DESTINATION ${VTK_SOURCE_DIR}/CMake ) + +# Fix for CMake 4 compatibility - CMP0022 policy cannot be set to OLD +file(COPY ${VTK_PATCH_DIR}/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake + DESTINATION ${VTK_SOURCE_DIR}/ThirdParty/libproj4/vtklibproj4/cmake/ +) diff --git a/Patches/VTK/8.2/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake b/Patches/VTK/8.2/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake new file mode 100644 index 00000000..a40ec25a --- /dev/null +++ b/Patches/VTK/8.2/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake @@ -0,0 +1,6 @@ +# Policies patched for CMake 4 compatibility +# CMP0022: INTERFACE_LINK_LIBRARIES defines the link interface +# CMake 4 no longer supports setting this to OLD, so we set it to NEW +if(POLICY CMP0022) + cmake_policy(SET CMP0022 NEW) +endif() diff --git a/Patches/VTK/9.0/Patch.cmake b/Patches/VTK/9.0/Patch.cmake index e12d042f..abda7fdb 100644 --- a/Patches/VTK/9.0/Patch.cmake +++ b/Patches/VTK/9.0/Patch.cmake @@ -21,3 +21,8 @@ file(COPY ${VTK_PATCH_DIR}/Rendering/Core/vtkColorTransferFunction.cxx file(COPY ${VTK_PATCH_DIR}/Filters/HyperTree/vtkHyperTreeGridThreshold.cxx DESTINATION ${VTK_SOURCE_DIR}/Filters/HyperTree/ ) + +# Fix for CMake 4 compatibility - CMP0022 policy cannot be set to OLD +file(COPY ${VTK_PATCH_DIR}/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake + DESTINATION ${VTK_SOURCE_DIR}/ThirdParty/libproj4/vtklibproj4/cmake/ +) diff --git a/Patches/VTK/9.0/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake b/Patches/VTK/9.0/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake new file mode 100644 index 00000000..a40ec25a --- /dev/null +++ b/Patches/VTK/9.0/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake @@ -0,0 +1,6 @@ +# Policies patched for CMake 4 compatibility +# CMP0022: INTERFACE_LINK_LIBRARIES defines the link interface +# CMake 4 no longer supports setting this to OLD, so we set it to NEW +if(POLICY CMP0022) + cmake_policy(SET CMP0022 NEW) +endif() diff --git a/Patches/VTK/9.5/Patch.cmake b/Patches/VTK/9.5/Patch.cmake new file mode 100644 index 00000000..d82f48d3 --- /dev/null +++ b/Patches/VTK/9.5/Patch.cmake @@ -0,0 +1,9 @@ +#+ +# This file is called as CMake -P script for the patch step of +# External_VTK.cmake for VTK 9.5 +#- + +# Fix for CMake 4 compatibility - CMP0022 policy cannot be set to OLD +file(COPY ${VTK_PATCH_DIR}/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake + DESTINATION ${VTK_SOURCE_DIR}/ThirdParty/libproj4/vtklibproj4/cmake/ +) diff --git a/Patches/VTK/9.5/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake b/Patches/VTK/9.5/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake new file mode 100644 index 00000000..a40ec25a --- /dev/null +++ b/Patches/VTK/9.5/ThirdParty/libproj4/vtklibproj4/cmake/policies.cmake @@ -0,0 +1,6 @@ +# Policies patched for CMake 4 compatibility +# CMP0022: INTERFACE_LINK_LIBRARIES defines the link interface +# CMake 4 no longer supports setting this to OLD, so we set it to NEW +if(POLICY CMP0022) + cmake_policy(SET CMP0022 NEW) +endif() From db556a7d9820d0069da187c722e47be1817e868e Mon Sep 17 00:00:00 2001 From: Matt Dawkins Date: Sat, 24 Jan 2026 13:02:56 -0500 Subject: [PATCH 4/6] Add VXL CMake 4 compatibility patch Add patch for vxl_shared_link_test CMakeLists.txt to fix CMake 4 compatibility. The original file had cmake_minimum_required version that was too old for CMake 4. The patched file updates the minimum version to 3.10 and sets appropriate policies for newer CMake versions. Co-Authored-By: Claude Opus 4.5 --- Patches/VXL/Patch.cmake | 7 ++++ .../vxl_shared_link_test/CMakeLists.txt | 33 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Patches/VXL/config/cmake/config/vxl_shared_link_test/CMakeLists.txt diff --git a/Patches/VXL/Patch.cmake b/Patches/VXL/Patch.cmake index cc5ba039..035dabf7 100644 --- a/Patches/VXL/Patch.cmake +++ b/Patches/VXL/Patch.cmake @@ -3,10 +3,17 @@ # External_VXL.cmake for VXL #- +message(STATUS "Patching VXL in ${VXL_SOURCE_DIR}") + file(COPY ${VXL_PATCH_DIR}/core/vbl/vbl_array_2d.h DESTINATION ${VXL_SOURCE_DIR}/core/vbl/ ) +# Fix CMake 4.x compatibility: cmake_minimum_required version too old +file(COPY ${VXL_PATCH_DIR}/config/cmake/config/vxl_shared_link_test/CMakeLists.txt + DESTINATION ${VXL_SOURCE_DIR}/config/cmake/config/vxl_shared_link_test/ +) + # fixes an issue with duplicate definition of lrintf() on Windows file(COPY ${VXL_PATCH_DIR}/v3p/openjpeg2/opj_includes.h DESTINATION ${VXL_SOURCE_DIR}/v3p/openjpeg2/ diff --git a/Patches/VXL/config/cmake/config/vxl_shared_link_test/CMakeLists.txt b/Patches/VXL/config/cmake/config/vxl_shared_link_test/CMakeLists.txt new file mode 100644 index 00000000..19f8ffed --- /dev/null +++ b/Patches/VXL/config/cmake/config/vxl_shared_link_test/CMakeLists.txt @@ -0,0 +1,33 @@ +# +cmake_minimum_required(VERSION 3.10.0 FATAL_ERROR) +# Set policies consistent with newer versions of cmake +# to ease integration with projects that require newer +# cmake versions. + +foreach(p + ## Only policies introduced after the cmake_minimum_required + ## version need to explicitly be set to NEW. + + ##----- Policies Introduced by CMake 3.10 + CMP0071 #: Let AUTOMOC and AUTOUIC process GENERATED files. + CMP0070 #: Define file(GENERATE) behavior for relative paths. + ##----- Policies Introduced by CMake 3.9 + CMP0069 #: INTERPROCEDURAL_OPTIMIZATION is enforced when enabled. + CMP0068 #: RPATH settings on macOS do not affect install_name. + ##----- Policies Introduced by CMake 3.8 + CMP0067 #: Honor language standard in try_compile() source-file signature. + ##----- Policies Introduced by CMake 3.7 + CMP0066 #: Honor per-config flags in try_compile() source-file signature. + ##----- Policies Introduced by CMake 3.4 + CMP0065 #: Do not add flags to export symbols from executables without the ENABLE_EXPORTS target property. + CMP0064 #: Support new TEST if() operator. + ) + if(POLICY ${p}) + cmake_policy(SET ${p} NEW) + endif() +endforeach() +project(vxl_pic_compatible) + +add_library(cmTryCompileStaticLib STATIC static_src.cxx) +add_library(cmTryCompileSharedLib SHARED shared_src.cxx) +target_link_libraries(cmTryCompileSharedLib cmTryCompileStaticLib ${LINK_LIBRARIES}) From f9a7a8dc139677320b36092b5ed2728cddec6f12 Mon Sep 17 00:00:00 2001 From: Matt Dawkins Date: Sat, 24 Jan 2026 13:03:04 -0500 Subject: [PATCH 5/6] Add CMake 4 compatibility patches for additional libraries - libjpeg-turbo: Remove cmake_policy(SET CMP0022 OLD) - libgeotiff: Remove cmake_policy(SET CMP0022 OLD) and CMP0042 OLD - x265: Remove cmake_policy(SET CMP0025 OLD) and CMP0054 OLD - yasm: Update cmake_minimum_required to 3.10, fix LOCATION property usage (CMP0026) by replacing with generator expressions These policies can no longer be set to OLD in CMake 4. Co-Authored-By: Claude Opus 4.5 --- Patches/libgeotiff/Patch.cmake | 13 +++++++ Patches/libjpeg-turbo/Patch.cmake | 6 +++ Patches/x265/Patch.cmake | 12 ++++++ Patches/yasm/Patch.cmake | 61 +++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 Patches/libgeotiff/Patch.cmake create mode 100644 Patches/yasm/Patch.cmake diff --git a/Patches/libgeotiff/Patch.cmake b/Patches/libgeotiff/Patch.cmake new file mode 100644 index 00000000..7ce9ad81 --- /dev/null +++ b/Patches/libgeotiff/Patch.cmake @@ -0,0 +1,13 @@ +#+ +# This file is called as CMake -P script for the patch step of +# External_libgeotiff.cmake +#- + +message("Patching libgeotiff ${libgeotiff_source}") + +# Remove cmake_policy(SET CMP0022 OLD) and cmake_policy(SET CMP0042 OLD) +# which are no longer supported in newer CMake versions +file(READ ${libgeotiff_source}/CMakeLists.txt _cmakelists_content) +string(REPLACE "cmake_policy(SET CMP0022 OLD)" "" _cmakelists_content "${_cmakelists_content}") +string(REPLACE "cmake_policy(SET CMP0042 OLD)" "" _cmakelists_content "${_cmakelists_content}") +file(WRITE ${libgeotiff_source}/CMakeLists.txt "${_cmakelists_content}") diff --git a/Patches/libjpeg-turbo/Patch.cmake b/Patches/libjpeg-turbo/Patch.cmake index 2b4579f5..945078a4 100644 --- a/Patches/libjpeg-turbo/Patch.cmake +++ b/Patches/libjpeg-turbo/Patch.cmake @@ -11,6 +11,12 @@ if (WIN32) ${libjpeg-turbo_patch}/simd/CMakeLists.txt DESTINATION ${libjpeg-turbo_source}/simd/ ) + + # Remove cmake_policy(SET CMP0022 OLD) which is no longer supported + # in newer CMake versions + file(READ ${libjpeg-turbo_source}/CMakeLists.txt _cmakelists_content) + string(REPLACE "cmake_policy(SET CMP0022 OLD)" "" _cmakelists_content "${_cmakelists_content}") + file(WRITE ${libjpeg-turbo_source}/CMakeLists.txt "${_cmakelists_content}") endif() # Patch config.guess for arm boards. diff --git a/Patches/x265/Patch.cmake b/Patches/x265/Patch.cmake index 02577e46..1c992bb6 100644 --- a/Patches/x265/Patch.cmake +++ b/Patches/x265/Patch.cmake @@ -4,3 +4,15 @@ configure_file( ${x265_source}/source/encoder/ COPYONLY ) + +# CMake 4 compatibility: Remove deprecated policy settings that cannot be set to OLD +# CMP0025 and CMP0054 can no longer be set to OLD in CMake 4.x +set(_x265_cmakelists "${x265_source}/source/CMakeLists.txt") +if(EXISTS "${_x265_cmakelists}") + file(READ "${_x265_cmakelists}" _x265_cmake_content) + # Remove cmake_policy(SET CMP0025 OLD) lines + string(REGEX REPLACE "cmake_policy\\([ \t]*SET[ \t]+CMP0025[ \t]+OLD[ \t]*\\)" "# cmake_policy(SET CMP0025 OLD) # Removed for CMake 4 compatibility" _x265_cmake_content "${_x265_cmake_content}") + # Remove cmake_policy(SET CMP0054 OLD) lines + string(REGEX REPLACE "cmake_policy\\([ \t]*SET[ \t]+CMP0054[ \t]+OLD[ \t]*\\)" "# cmake_policy(SET CMP0054 OLD) # Removed for CMake 4 compatibility" _x265_cmake_content "${_x265_cmake_content}") + file(WRITE "${_x265_cmakelists}" "${_x265_cmake_content}") +endif() diff --git a/Patches/yasm/Patch.cmake b/Patches/yasm/Patch.cmake new file mode 100644 index 00000000..a436c3de --- /dev/null +++ b/Patches/yasm/Patch.cmake @@ -0,0 +1,61 @@ +# CMake 4 compatibility patch for yasm +# Updates cmake_minimum_required to VERSION 3.10 (minimum required by CMake 4) +# Fixes LOCATION property errors (CMP0026) by using generator expressions + +set(_yasm_cmakelists "${yasm_source}/CMakeLists.txt") +if(EXISTS "${_yasm_cmakelists}") + file(READ "${_yasm_cmakelists}" _yasm_cmake_content) + # Replace cmake_minimum_required with versions < 3.10 to 3.10 (lowercase) + string(REGEX REPLACE + "cmake_minimum_required[ \t]*\\([ \t]*VERSION[ \t]+([0-2]\\.[0-9]+|3\\.[0-9])[ \t]*\\)" + "cmake_minimum_required(VERSION 3.10)" + _yasm_cmake_content "${_yasm_cmake_content}") + # Replace CMAKE_MINIMUM_REQUIRED with versions < 3.10 to 3.10 (uppercase) + string(REGEX REPLACE + "CMAKE_MINIMUM_REQUIRED[ \t]*\\([ \t]*VERSION[ \t]+([0-2]\\.[0-9]+|3\\.[0-9])[ \t]*\\)" + "cmake_minimum_required(VERSION 3.10)" + _yasm_cmake_content "${_yasm_cmake_content}") + file(WRITE "${_yasm_cmakelists}" "${_yasm_cmake_content}") +endif() + +# Fix YasmMacros.cmake - replace get_target_property LOCATION with generator expressions +# This fixes CMake policy CMP0026 violations +set(_yasm_macros "${yasm_source}/cmake/modules/YasmMacros.cmake") +if(EXISTS "${_yasm_macros}") + file(READ "${_yasm_macros}" _macros_content) + + # Fix YASM_GENPERF macro - handle both GET_TARGET_PROPERTY and get_target_property + # Match: GET_TARGET_PROPERTY(GENPERF_EXE genperf LOCATION) or similar variable names + string(REGEX REPLACE + "[Gg][Ee][Tt]_[Tt][Aa][Rr][Gg][Ee][Tt]_[Pp][Rr][Oo][Pp][Ee][Rr][Tt][Yy][ \t]*\\([ \t]*([A-Za-z_][A-Za-z0-9_]*)[ \t]+genperf[ \t]+LOCATION[ \t]*\\)" + "set(\\1 \"$\")" + _macros_content "${_macros_content}") + + # Fix YASM_RE2C macro + string(REGEX REPLACE + "[Gg][Ee][Tt]_[Tt][Aa][Rr][Gg][Ee][Tt]_[Pp][Rr][Oo][Pp][Ee][Rr][Tt][Yy][ \t]*\\([ \t]*([A-Za-z_][A-Za-z0-9_]*)[ \t]+re2c[ \t]+LOCATION[ \t]*\\)" + "set(\\1 \"$\")" + _macros_content "${_macros_content}") + + # Fix YASM_GENMACRO macro + string(REGEX REPLACE + "[Gg][Ee][Tt]_[Tt][Aa][Rr][Gg][Ee][Tt]_[Pp][Rr][Oo][Pp][Ee][Rr][Tt][Yy][ \t]*\\([ \t]*([A-Za-z_][A-Za-z0-9_]*)[ \t]+genmacro[ \t]+LOCATION[ \t]*\\)" + "set(\\1 \"$\")" + _macros_content "${_macros_content}") + + file(WRITE "${_yasm_macros}" "${_macros_content}") +endif() + +# Fix modules/preprocs/nasm/CMakeLists.txt - genversion LOCATION property +set(_nasm_preproc "${yasm_source}/modules/preprocs/nasm/CMakeLists.txt") +if(EXISTS "${_nasm_preproc}") + file(READ "${_nasm_preproc}" _nasm_content) + + # Fix genversion LOCATION property - handle both GET_TARGET_PROPERTY and get_target_property + string(REGEX REPLACE + "[Gg][Ee][Tt]_[Tt][Aa][Rr][Gg][Ee][Tt]_[Pp][Rr][Oo][Pp][Ee][Rr][Tt][Yy][ \t]*\\([ \t]*([A-Za-z_][A-Za-z0-9_]*)[ \t]+genversion[ \t]+LOCATION[ \t]*\\)" + "set(\\1 \"$\")" + _nasm_content "${_nasm_content}") + + file(WRITE "${_nasm_preproc}" "${_nasm_content}") +endif() From d6987c134452ff692ff9f7be80af15cdc30d0876 Mon Sep 17 00:00:00 2001 From: Matt Dawkins Date: Sat, 24 Jan 2026 13:03:10 -0500 Subject: [PATCH 6/6] Update External cmake files to use new patches and COMMON_CMAKE_ARGS - External_CppDB.cmake: Use COMMON_CMAKE_ARGS for consistency - External_libgeotiff.cmake: Add PATCH_COMMAND to apply new patch - External_yasm.cmake: Add PATCH_COMMAND and use COMMON_CMAKE_ARGS This wires up the new CMake 4 compatibility patches to be applied during the build process. Co-Authored-By: Claude Opus 4.5 --- CMake/External_CppDB.cmake | 5 ++--- CMake/External_libgeotiff.cmake | 3 +++ CMake/External_yasm.cmake | 14 +++++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CMake/External_CppDB.cmake b/CMake/External_CppDB.cmake index f8b1001f..7f5d7e6e 100644 --- a/CMake/External_CppDB.cmake +++ b/CMake/External_CppDB.cmake @@ -26,9 +26,8 @@ ExternalProject_Add(CppDB -DCppDB_source=${fletch_BUILD_PREFIX}/src/CppDB -P ${fletch_SOURCE_DIR}/Patches/CppDB/Patch.cmake CMAKE_ARGS - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_INSTALL_PREFIX:PATH=${fletch_BUILD_INSTALL_PREFIX} + ${COMMON_CMAKE_ARGS} + -DDISABLE_SQLITE:BOOL=ON ${_CppDB_ARGS_PostgreSQL} ) diff --git a/CMake/External_libgeotiff.cmake b/CMake/External_libgeotiff.cmake index 764ff45a..7d1611a9 100644 --- a/CMake/External_libgeotiff.cmake +++ b/CMake/External_libgeotiff.cmake @@ -121,6 +121,9 @@ ExternalProject_Add(libgeotiff URL_MD5 ${libgeotiff_md5} ${COMMON_EP_ARGS} ${COMMON_CMAKE_EP_ARGS} + PATCH_COMMAND ${CMAKE_COMMAND} + -Dlibgeotiff_source:PATH=${fletch_BUILD_PREFIX}/src/libgeotiff + -P ${fletch_SOURCE_DIR}/Patches/libgeotiff/Patch.cmake CMAKE_ARGS ${COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${fletch_BUILD_INSTALL_PREFIX} diff --git a/CMake/External_yasm.cmake b/CMake/External_yasm.cmake index bd303ed4..d59bdc53 100644 --- a/CMake/External_yasm.cmake +++ b/CMake/External_yasm.cmake @@ -30,6 +30,17 @@ if (fletch_ENABLE_CPython) ) endif() +set(yasm_patch ${fletch_SOURCE_DIR}/Patches/yasm) +if(EXISTS ${yasm_patch}) + set(yasm_PATCH_COMMAND ${CMAKE_COMMAND} + -Dyasm_patch:PATH=${yasm_patch} + -Dyasm_source:PATH=${fletch_BUILD_PREFIX}/src/yasm + -P ${yasm_patch}/Patch.cmake + ) +else() + set(yasm_PATCH_COMMAND "") +endif() + if (NOT _external_yasm_include) set(_external_yasm_include TRUE) ExternalProject_Add(yasm @@ -38,11 +49,12 @@ if (NOT _external_yasm_include) URL_MD5 ${yasm_md5} ${COMMON_EP_ARGS} ${COMMON_CMAKE_EP_ARGS} + PATCH_COMMAND ${yasm_PATCH_COMMAND} INSTALL_COMMAND "" CMAKE_ARGS + ${COMMON_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE:FILEPATH=${yasm_PYTHON_EXECUTABLE} - -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} -DBUILD_SHARED_LIBS=OFF )