| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | # - Find the FFTW library
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Usage:
 | 
					
						
							|  |  |  | #   find_package(FFTW [REQUIRED] [QUIET] )
 | 
					
						
							|  |  |  | #     
 | 
					
						
							|  |  |  | # It sets the following variables:
 | 
					
						
							|  |  |  | #   FFTW_FOUND               ... true if fftw is found on the system
 | 
					
						
							|  |  |  | #   FFTW_LIBRARIES           ... full path to fftw library
 | 
					
						
							|  |  |  | #   FFTW_INCLUDES            ... fftw include directory
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # The following variables will be checked by the function
 | 
					
						
							|  |  |  | #   FFTW_USE_STATIC_LIBS    ... if true, only static libraries are found
 | 
					
						
							|  |  |  | #   FFTW_ROOT               ... if set, the libraries are exclusively searched
 | 
					
						
							|  |  |  | #                               under this path
 | 
					
						
							|  |  |  | #   FFTW_LIBRARY            ... fftw library to use
 | 
					
						
							|  |  |  | #   FFTW_INCLUDE_DIR        ... fftw include directory
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2009-06-11 10:16:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | #If environment variable FFTWDIR is specified, it has same effect as FFTW_ROOT
 | 
					
						
							|  |  |  | if( NOT FFTW_ROOT AND ENV{FFTWDIR} )
 | 
					
						
							|  |  |  |   set( FFTW_ROOT $ENV{FFTWDIR} )
 | 
					
						
							|  |  |  | endif()
 | 
					
						
							| 
									
										
										
										
											2009-06-11 10:16:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | # Check if we can use PkgConfig
 | 
					
						
							| 
									
										
										
										
											2021-07-16 23:24:23 +08:00
										 |  |  | include(CMakeFindDependencyMacro)
 | 
					
						
							|  |  |  | find_dependency(PkgConfig)
 | 
					
						
							| 
									
										
										
										
											2009-06-11 10:16:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | #Determine from PKG
 | 
					
						
							|  |  |  | if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT )
 | 
					
						
							|  |  |  |   pkg_check_modules( PKG_FFTW QUIET "fftw3" )
 | 
					
						
							|  |  |  | endif()
 | 
					
						
							| 
									
										
										
										
											2011-01-28 23:54:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | #Check whether to search static or dynamic libs
 | 
					
						
							|  |  |  | set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} )
 | 
					
						
							| 
									
										
										
										
											2011-01-28 23:54:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | if( ${FFTW_USE_STATIC_LIBS} )
 | 
					
						
							|  |  |  |   set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} )
 | 
					
						
							|  |  |  | else()
 | 
					
						
							|  |  |  |   set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX} )
 | 
					
						
							| 
									
										
										
										
											2011-01-28 23:54:01 +08:00
										 |  |  | endif()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | if( FFTW_ROOT )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   #find libs
 | 
					
						
							|  |  |  |   find_library( | 
					
						
							|  |  |  |     FFTW_LIB
 | 
					
						
							|  |  |  |     NAMES "fftw3"
 | 
					
						
							|  |  |  |     PATHS ${FFTW_ROOT}
 | 
					
						
							|  |  |  |     PATH_SUFFIXES "lib" "lib64"
 | 
					
						
							|  |  |  |     NO_DEFAULT_PATH
 | 
					
						
							|  |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   find_library( | 
					
						
							|  |  |  |     FFTWF_LIB
 | 
					
						
							|  |  |  |     NAMES "fftw3f"
 | 
					
						
							|  |  |  |     PATHS ${FFTW_ROOT}
 | 
					
						
							|  |  |  |     PATH_SUFFIXES "lib" "lib64"
 | 
					
						
							|  |  |  |     NO_DEFAULT_PATH
 | 
					
						
							|  |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   find_library( | 
					
						
							|  |  |  |     FFTWL_LIB
 | 
					
						
							|  |  |  |     NAMES "fftw3l"
 | 
					
						
							|  |  |  |     PATHS ${FFTW_ROOT}
 | 
					
						
							|  |  |  |     PATH_SUFFIXES "lib" "lib64"
 | 
					
						
							|  |  |  |     NO_DEFAULT_PATH
 | 
					
						
							|  |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   #find includes
 | 
					
						
							|  |  |  |   find_path( | 
					
						
							|  |  |  |     FFTW_INCLUDES
 | 
					
						
							|  |  |  |     NAMES "fftw3.h"
 | 
					
						
							|  |  |  |     PATHS ${FFTW_ROOT}
 | 
					
						
							|  |  |  |     PATH_SUFFIXES "include"
 | 
					
						
							|  |  |  |     NO_DEFAULT_PATH
 | 
					
						
							|  |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | else()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   find_library( | 
					
						
							|  |  |  |     FFTW_LIB
 | 
					
						
							|  |  |  |     NAMES "fftw3"
 | 
					
						
							|  |  |  |     PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
 | 
					
						
							|  |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   find_library( | 
					
						
							|  |  |  |     FFTWF_LIB
 | 
					
						
							|  |  |  |     NAMES "fftw3f"
 | 
					
						
							|  |  |  |     PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
 | 
					
						
							|  |  |  |   )
 | 
					
						
							| 
									
										
										
										
											2011-01-28 23:54:01 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   find_library( | 
					
						
							|  |  |  |     FFTWL_LIB
 | 
					
						
							|  |  |  |     NAMES "fftw3l"
 | 
					
						
							|  |  |  |     PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
 | 
					
						
							|  |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   find_path( | 
					
						
							|  |  |  |     FFTW_INCLUDES
 | 
					
						
							|  |  |  |     NAMES "fftw3.h"
 | 
					
						
							|  |  |  |     PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR}
 | 
					
						
							|  |  |  |   )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-01 00:36:27 +08:00
										 |  |  | endif()
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB})
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if(FFTWL_LIB)
 | 
					
						
							|  |  |  |   set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTWL_LIB})
 | 
					
						
							|  |  |  | endif()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )
 | 
					
						
							| 
									
										
										
										
											2009-06-11 10:16:32 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | include(FindPackageHandleStandardArgs)
 | 
					
						
							|  |  |  | find_package_handle_standard_args(FFTW DEFAULT_MSG | 
					
						
							|  |  |  |                                   FFTW_INCLUDES FFTW_LIBRARIES)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-09 22:54:15 +08:00
										 |  |  | mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)
 | 
					
						
							| 
									
										
										
										
											2012-03-15 22:18:22 +08:00
										 |  |  | 
 |