You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
2.7 KiB

  1. # - Find the FFTW library
  2. #
  3. # Usage:
  4. # find_package(FFTW [REQUIRED] [QUIET] )
  5. #
  6. # It sets the following variables:
  7. # FFTW_FOUND ... true if fftw is found on the system
  8. # FFTW_LIBRARIES ... full path to fftw library
  9. # FFTW_INCLUDES ... fftw include directory
  10. #
  11. # The following variables will be checked by the function
  12. # FFTW_USE_STATIC_LIBS ... if true, only static libraries are found
  13. # FFTW_ROOT ... if set, the libraries are exclusively searched
  14. # under this path
  15. # FFTW_LIBRARY ... fftw library to use
  16. # FFTW_INCLUDE_DIR ... fftw include directory
  17. #
  18. #If environment variable FFTWDIR is specified, it has same effect as FFTW_ROOT
  19. if( NOT FFTW_ROOT AND ENV{FFTWDIR} )
  20. set( FFTW_ROOT $ENV{FFTWDIR} )
  21. endif()
  22. # Check if we can use PkgConfig
  23. find_package(PkgConfig)
  24. #Determine from PKG
  25. if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT )
  26. pkg_check_modules( PKG_FFTW QUIET "fftw3" )
  27. endif()
  28. #Check whether to search static or dynamic libs
  29. set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} )
  30. if( ${FFTW_USE_STATIC_LIBS} )
  31. set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} )
  32. else()
  33. set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX} )
  34. endif()
  35. if( FFTW_ROOT )
  36. #find libs
  37. find_library(
  38. FFTW_LIB
  39. NAMES "fftw3"
  40. PATHS ${FFTW_ROOT}
  41. PATH_SUFFIXES "lib" "lib64"
  42. NO_DEFAULT_PATH
  43. )
  44. find_library(
  45. FFTWF_LIB
  46. NAMES "fftw3f"
  47. PATHS ${FFTW_ROOT}
  48. PATH_SUFFIXES "lib" "lib64"
  49. NO_DEFAULT_PATH
  50. )
  51. find_library(
  52. FFTWL_LIB
  53. NAMES "fftw3l"
  54. PATHS ${FFTW_ROOT}
  55. PATH_SUFFIXES "lib" "lib64"
  56. NO_DEFAULT_PATH
  57. )
  58. #find includes
  59. find_path(
  60. FFTW_INCLUDES
  61. NAMES "fftw3.h"
  62. PATHS ${FFTW_ROOT}
  63. PATH_SUFFIXES "include"
  64. NO_DEFAULT_PATH
  65. )
  66. else()
  67. find_library(
  68. FFTW_LIB
  69. NAMES "fftw3"
  70. PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
  71. )
  72. find_library(
  73. FFTWF_LIB
  74. NAMES "fftw3f"
  75. PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
  76. )
  77. find_library(
  78. FFTWL_LIB
  79. NAMES "fftw3l"
  80. PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
  81. )
  82. find_path(
  83. FFTW_INCLUDES
  84. NAMES "fftw3.h"
  85. PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR}
  86. )
  87. endif( FFTW_ROOT )
  88. set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB})
  89. if(FFTWL_LIB)
  90. set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTWL_LIB})
  91. endif()
  92. set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )
  93. include(FindPackageHandleStandardArgs)
  94. find_package_handle_standard_args(FFTW DEFAULT_MSG
  95. FFTW_INCLUDES FFTW_LIBRARIES)
  96. mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)