Skip to content

Commit ce28711

Browse files
committed
fix FFTW 3
1 parent 35e4c52 commit ce28711

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

toolchain/dependencies/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,29 @@ if (MFC_FFTW)
3232
add_custom_target(fftw)
3333
else()
3434
if (NOT CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
35+
message(STATUS "FFTW: Preparing to configure with CMake 4.0 compatibility fix")
36+
37+
# Patch FFTW CMakeLists.txt
38+
file(WRITE "${CMAKE_BINARY_DIR}/patch_fftw.cmake"
39+
"file(READ \"\${SOURCE_DIR}/CMakeLists.txt\" content)
40+
string(REPLACE \"cmake_minimum_required(VERSION 2.8\" \"cmake_minimum_required(VERSION 3.5\" content \"\${content}\")
41+
file(WRITE \"\${SOURCE_DIR}/CMakeLists.txt\" \"\${content}\")
42+
message(STATUS \"FFTW: CMakeLists.txt patched to require CMake 3.5+\")")
43+
3544
ExternalProject_Add(fftw
3645
URL "http://www.fftw.org/fftw-3.3.10.tar.gz"
46+
# More debugging info
47+
LOG_DOWNLOAD ON
48+
LOG_UPDATE ON
49+
LOG_CONFIGURE ON
50+
LOG_BUILD ON
51+
LOG_INSTALL ON
52+
LOG_PATCH ON
53+
# Add this to patch the CMakeLists file before configure
54+
PATCH_COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=<SOURCE_DIR> -P ${CMAKE_BINARY_DIR}/patch_fftw.cmake
3755
CMAKE_ARGS -DBUILD_TESTS=OFF
3856
-DBUILD_SHARED_LIBS=OFF
57+
# Not enough to fix the issue, but we'll keep it
3958
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
4059
"-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
4160
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--- CMakeLists.txt.orig
2+
+++ CMakeLists.txt
3+
@@ -1,4 +1,4 @@
4+
-cmake_minimum_required(VERSION 2.8.0)
5+
+cmake_minimum_required(VERSION 3.5)
6+
7+
project(fftw)

0 commit comments

Comments
 (0)