Skip to content

Commit

Permalink
Fix AMReX::FFTW Once
Browse files Browse the repository at this point in the history
In situations like superbuilds or other downstream usage,
the `AMReX::FFTW` should only be created once.
  • Loading branch information
ax3l committed Jan 12, 2025
1 parent 041f225 commit c6ee970
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Tools/CMake/FindAMReXFFTW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ if(NOT AMReX_FFTW_SEARCH IN_LIST AMReX_FFTW_SEARCH_VALUES)
endif()
mark_as_advanced(AMReX_FFTW_SEARCH)

# Create imported target
add_library(AMReX::FFTW INTERFACE IMPORTED GLOBAL)

function(fftw_find_precision HFFTWp)
if(AMReX_FFTW_SEARCH STREQUAL CMAKE)
find_package(FFTW3${HFFTWp} CONFIG REQUIRED)
Expand Down Expand Up @@ -138,9 +135,14 @@ function(fftw_find_precision HFFTWp)
endif()
endfunction()

# floating point precision suffixes: we request float and double precision
fftw_find_precision("")
fftw_find_precision("f")
if(NOT TARGET AMReX::FFTW)
# Create imported target
add_library(AMReX::FFTW INTERFACE IMPORTED GLOBAL)

# floating point precision suffixes: we request float and double precision
fftw_find_precision("")
fftw_find_precision("f")
endif()

# Vars for CMake config
include(FindPackageHandleStandardArgs)
Expand Down

0 comments on commit c6ee970

Please sign in to comment.