|
From: <kin...@us...> - 2025-09-12 09:03:48
|
Revision: 7419
http://sourceforge.net/p/teem/code/7419
Author: kindlmann
Date: 2025-09-12 09:03:45 +0000 (Fri, 12 Sep 2025)
Log Message:
-----------
maybe finally done with these
Modified Paths:
--------------
teem/trunk/CMake/FindFFTW3-v2.cmake
teem/trunk/CMake/FindLEVMAR-v2.cmake
teem/trunk/CMakeLists-v2.txt
Modified: teem/trunk/CMake/FindFFTW3-v2.cmake
===================================================================
--- teem/trunk/CMake/FindFFTW3-v2.cmake 2025-09-12 08:20:59 UTC (rev 7418)
+++ teem/trunk/CMake/FindFFTW3-v2.cmake 2025-09-12 09:03:45 UTC (rev 7419)
@@ -1,4 +1,5 @@
## FindFFTW3.cmake: Slightly better way of looking for FFTW3 package
+# ("fftw3" = http://www.fftw.org)
# Copyright (C) 2025 University of Chicago
# See ../LICENSE.txt for licensing terms
@@ -7,10 +8,31 @@
# actually does, so find_package(FFTW3) can succeed but is not able to define imported
# targets for use with target_link_libraries(FFTW3::fftw3) This is a long-standing issue:
# https://github.com/FFTW/fftw3/issues/130
-# and there must be various solutions out there, since ChatGPT basically wrote the code
-# below (and is characterically unable to provide a citation for similarly simple but
-# working code online)
#
+# This module defines:
+# FFTW3_FOUND - True if both header and library were found
+# FFTW3_INCLUDE_DIR - Directory containing fftw3.h
+# (legacy; for include_directories)
+# FFTW3_LIBRARY - Full path to the fftw3 library file
+# (legacy; for direct linking)
+# FFTW3_INCLUDE_DIRS - Directories to add to include path
+# (legacy; currently just fftw3)
+# FFTW3_LIBRARIES - Libraries to link
+# (legacy; just fftw3, no transitive deps)
+# FFTW3_VERSION - Optional version string for the library; not reliably
+# parse-able from fftw3.h, so will be empty unless
+# supplied by the user or cache.
+#
+# Imported target (modern CMake usage):
+# FFTW3::fftw3 - Imported target for modern target_link_libraries usage
+#
+# Usage:
+# find_package(FFTW3 REQUIRED)
+# target_link_libraries(myexe PRIVATE FFTW3::fftw3)
+# # or for legacy code:
+# target_include_directories(myexe PRIVATE ${FFTW3_INCLUDE_DIRS})
+# target_link_libraries(myexe PRIVATE ${FFTW3_LIBRARIES})
+#
# For comparison look at:
# https://github.com/egpbos/findFFTW
# https://github.com/acoustid/chromaprint/blob/master/cmake/modules/FindFFTW3.cmake
@@ -52,23 +74,44 @@
# This fallback only runs when FFTW3_FOUND is still FALSE.
if(NOT FFTW3_FOUND)
- # Look for the FFTW3 header. Users can help by setting FFTW3_DIR or
+ # Find the directory containing fftw3.h. Users can help by setting FFTW3_DIR or
# by making sure the header is somewhere in the default search paths.
find_path(FFTW3_INCLUDE_DIR
NAMES fftw3.h
- HINTS ENV FFTW3_DIR # WHAT MORE hints?
- PATH_SUFFIXES include
+ HINTS
+ $ENV{FFTW3_DIR}
+ ${CMAKE_INSTALL_PREFIX}
+ /usr
+ /usr/local
+ PATH_SUFFIXES
+ include
+ include/fftw3
+ DOC "Directory containing fftw3.h"
)
_status("find_path result: FFTW3_INCLUDE_DIR='${FFTW3_INCLUDE_DIR}'")
- # Look for the FFTW3 library. Allow FFTW3_DIR to point to its prefix.
+ # Look for the FFTW3 library. Can set FFTW3_DIR to containing directory.
find_library(FFTW3_LIBRARY
NAMES fftw3
- HINTS ENV FFTW3_DIR # WHAT MORE hints?
- PATH_SUFFIXES lib
+ HINTS
+ $ENV{FFTW3_DIR}
+ ${CMAKE_INSTALL_PREFIX}
+ /usr
+ /usr/local
+ PATH_SUFFIXES
+ lib
+ lib64
+ DOC "Full path to the libfftw3.\{a\|so\|dylib\|lib\} file"
)
_status("find_library result: FFTW3_LIBRARY='${FFTW3_LIBRARY}'")
+ # Optional user-provided version (since fftw3.h does not seem to declare its own
+ # version in any way that can be learned at configure- or compile-time (the info is
+ # available at run-time, but that's too annoying).
+ if(NOT DEFINED FFTW3_VERSION)
+ set(FFTW3_VERSION "" CACHE STRING "Optional: version of FFTW3 library")
+ endif()
+
# Include the helper macro for standard handling of results
include(FindPackageHandleStandardArgs)
# Sets FFTW3_FOUND if successful
@@ -75,9 +118,14 @@
_check_start("find_package_handle_standard_args(FFTW3)")
find_package_handle_standard_args(FFTW3
REQUIRED_VARS FFTW3_LIBRARY FFTW3_INCLUDE_DIR
+ VERSION_VAR FFTW3_VERSION
)
if (FFTW3_FOUND)
+ # for use by old-style CMake code
+ set(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR})
+ set(FFTW3_LIBRARIES ${FFTW3_LIBRARY})
+
# If we did find FFTW3, but no imported target exists yet,
# create our own IMPORTED target so downstream code can use:
# target_link_libraries(myprog PRIVATE FFTW3::fftw3)
@@ -86,7 +134,7 @@
set_target_properties(FFTW3::fftw3 PROPERTIES
IMPORTED_LOCATION "${FFTW3_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR}"
- # HEY no INTERFACE_LINK_LIBRARIES ?
+ INTERFACE_LINK_LIBRARIES "${FFTW3_LIBRARY}" # maybe redundant?
)
endif()
_check_pass("Found:\n ${_dep}_INCLUDE_DIR=${${_dep}_INCLUDE_DIR}\n ${_dep}_LIBRARY=${${_dep}_LIBRARY}")
Modified: teem/trunk/CMake/FindLEVMAR-v2.cmake
===================================================================
--- teem/trunk/CMake/FindLEVMAR-v2.cmake 2025-09-12 08:20:59 UTC (rev 7418)
+++ teem/trunk/CMake/FindLEVMAR-v2.cmake 2025-09-12 09:03:45 UTC (rev 7419)
@@ -101,6 +101,7 @@
set(LEVMAR_VERSION "${CMAKE_MATCH_1}")
_status("From levmar.h parsed version: ${LEVMAR_VERSION}")
endif()
+ unset(_levmar_header)
endif()
# Try to find full path to liblevmar library file
Modified: teem/trunk/CMakeLists-v2.txt
===================================================================
--- teem/trunk/CMakeLists-v2.txt 2025-09-12 08:20:59 UTC (rev 7418)
+++ teem/trunk/CMakeLists-v2.txt 2025-09-12 09:03:45 UTC (rev 7419)
@@ -203,7 +203,7 @@
endforeach()
# With all that uniformity set up: try to find_package() for all DEPs requested,
-# and set Teem_HAVE_DEP if we did find it (i.e. we "have" it)
+# and set Teem_HAVE_DEP if we did find it (i.e. we "have" found the dependency)
foreach(_tdep IN LISTS _Teem_DEPS)
if(Teem_USE_${_tdep})
# this DEP is requested
@@ -211,7 +211,11 @@
find_package(${_Teem_dep_cpname_${_tdep}} ${_Teem_dep_version_${_tdep}} QUIET)
if(${_Teem_dep_found_${_tdep}})
set(Teem_HAVE_${_tdep} TRUE)
- message(CHECK_PASS "Found")
+ if(DEFINED ${_tdep}_VERSION)
+ message(CHECK_PASS "Found version ${${_tdep}_VERSION}")
+ else()
+ message(CHECK_PASS "Found")
+ endif()
else()
if(DEFINED ${_tdep}_VERSION AND _Teem_dep_version_${_tdep})
message(CHECK_FAIL
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|