Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CMake/External_CppDB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)

Expand Down
3 changes: 3 additions & 0 deletions CMake/External_libgeotiff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
14 changes: 13 additions & 1 deletion CMake/External_yasm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)

Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
#
Expand Down
2 changes: 1 addition & 1 deletion Patches/Boost/Common.cmake
Original file line number Diff line number Diff line change
@@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion Patches/CppDB/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.10)
project(cppdb)

set(CPPDB_MAJOR 0)
Expand Down
2 changes: 1 addition & 1 deletion Patches/PostgreSQL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}/../../..)
Expand Down
2 changes: 2 additions & 0 deletions Patches/PostgreSQL/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
5 changes: 5 additions & 0 deletions Patches/VTK/8.0/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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/
)
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 5 additions & 0 deletions Patches/VTK/8.2/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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/
)
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 5 additions & 0 deletions Patches/VTK/9.0/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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/
)
Original file line number Diff line number Diff line change
@@ -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()
9 changes: 9 additions & 0 deletions Patches/VTK/9.5/Patch.cmake
Original file line number Diff line number Diff line change
@@ -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/
)
Original file line number Diff line number Diff line change
@@ -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()
7 changes: 7 additions & 0 deletions Patches/VXL/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
Original file line number Diff line number Diff line change
@@ -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})
13 changes: 13 additions & 0 deletions Patches/libgeotiff/Patch.cmake
Original file line number Diff line number Diff line change
@@ -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}")
6 changes: 6 additions & 0 deletions Patches/libjpeg-turbo/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Patches/libsvm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 12 additions & 0 deletions Patches/x265/Patch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
61 changes: 61 additions & 0 deletions Patches/yasm/Patch.cmake
Original file line number Diff line number Diff line change
@@ -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 \"$<TARGET_FILE:genperf>\")"
_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 \"$<TARGET_FILE:re2c>\")"
_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 \"$<TARGET_FILE:genmacro>\")"
_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 \"$<TARGET_FILE:genversion>\")"
_nasm_content "${_nasm_content}")

file(WRITE "${_nasm_preproc}" "${_nasm_content}")
endif()