Skip to content

Commit 1bc7d0f

Browse files
committed
another attempt
1 parent 17837c2 commit 1bc7d0f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

toolchain/cmake/regular/FindFFTW.cmake

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# FindFFTW.cmake — Enhanced to support apt installs, env hints, and pkg-config
1+
# Robust FFTW finder: supports pkg-config, system installs, and manual hints
22

3-
# Try pkg-config first (if available)
43
find_package(PkgConfig QUIET)
54
if(PkgConfig_FOUND)
65
pkg_check_modules(PC_FFTW QUIET fftw3)
76
endif()
87

9-
# Build include + lib search paths
8+
# Search locations
109
set(FFTW_HINTED_INCLUDE
1110
$ENV{FFTW_INCLUDE_DIR}
1211
${PC_FFTW_INCLUDE_DIRS}
@@ -23,7 +22,7 @@ set(FFTW_HINTED_LIBRARY
2322
/usr/lib/x86_64-linux-gnu
2423
)
2524

26-
# Locate fftw3.h and libfftw3.so
25+
# Locate paths
2726
find_path(FFTW_INCLUDE_DIR
2827
NAMES fftw3.h
2928
HINTS ${FFTW_HINTED_INCLUDE}
@@ -34,9 +33,10 @@ find_library(FFTW_LIBRARY
3433
HINTS ${FFTW_HINTED_LIBRARY}
3534
)
3635

37-
# Required FFTW_FOUND logic
36+
# Safe version check
3837
include(FindPackageHandleStandardArgs)
39-
if(PC_FFTW_VERSION)
38+
39+
if(DEFINED PC_FFTW_VERSION AND NOT "${PC_FFTW_VERSION}" STREQUAL "")
4040
find_package_handle_standard_args(FFTW
4141
REQUIRED_VARS FFTW_LIBRARY FFTW_INCLUDE_DIR
4242
VERSION_VAR PC_FFTW_VERSION
@@ -46,11 +46,10 @@ else()
4646
REQUIRED_VARS FFTW_LIBRARY FFTW_INCLUDE_DIR
4747
)
4848
endif()
49-
)
5049

5150
mark_as_advanced(FFTW_INCLUDE_DIR FFTW_LIBRARY)
5251

53-
# Define an imported target (optional but modern)
52+
# Optional modern target
5453
if(FFTW_FOUND AND NOT TARGET FFTW::FFTW)
5554
add_library(FFTW::FFTW UNKNOWN IMPORTED)
5655
set_target_properties(FFTW::FFTW PROPERTIES

0 commit comments

Comments
 (0)