Skip to content

Commit 3985925

Browse files
committed
yet another attempt at finding FFTW
1 parent 1bc7d0f commit 3985925

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

toolchain/cmake/regular/FindFFTW.cmake

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
1-
# Robust FFTW finder: supports pkg-config, system installs, and manual hints
1+
# FindFFTW.cmake — robust FFTW detection for system installs & CI
22

33
find_package(PkgConfig QUIET)
44
if(PkgConfig_FOUND)
55
pkg_check_modules(PC_FFTW QUIET fftw3)
66
endif()
77

8-
# Search locations
9-
set(FFTW_HINTED_INCLUDE
10-
$ENV{FFTW_INCLUDE_DIR}
11-
${PC_FFTW_INCLUDE_DIRS}
12-
/usr/include
13-
/usr/local/include
14-
)
15-
16-
set(FFTW_HINTED_LIBRARY
17-
$ENV{FFTW_LIBRARY}
18-
${PC_FFTW_LIBRARY_DIRS}
19-
/usr/lib
20-
/usr/lib64
21-
/usr/local/lib
22-
/usr/lib/x86_64-linux-gnu
23-
)
24-
25-
# Locate paths
8+
# Search for the include directory
269
find_path(FFTW_INCLUDE_DIR
2710
NAMES fftw3.h
28-
HINTS ${FFTW_HINTED_INCLUDE}
11+
HINTS
12+
${PC_FFTW_INCLUDE_DIRS}
13+
/usr/include
14+
/usr/local/include
15+
/opt/include
2916
)
3017

18+
# Search for the library
3119
find_library(FFTW_LIBRARY
3220
NAMES fftw3
33-
HINTS ${FFTW_HINTED_LIBRARY}
21+
HINTS
22+
${PC_FFTW_LIBRARY_DIRS}
23+
/usr/lib
24+
/usr/lib64
25+
/usr/local/lib
26+
/opt/lib
27+
/usr/lib/x86_64-linux-gnu
3428
)
3529

36-
# Safe version check
30+
# Import handling
3731
include(FindPackageHandleStandardArgs)
3832

3933
if(DEFINED PC_FFTW_VERSION AND NOT "${PC_FFTW_VERSION}" STREQUAL "")
@@ -49,7 +43,7 @@ endif()
4943

5044
mark_as_advanced(FFTW_INCLUDE_DIR FFTW_LIBRARY)
5145

52-
# Optional modern target
46+
# Optional modern target alias
5347
if(FFTW_FOUND AND NOT TARGET FFTW::FFTW)
5448
add_library(FFTW::FFTW UNKNOWN IMPORTED)
5549
set_target_properties(FFTW::FFTW PROPERTIES

0 commit comments

Comments
 (0)