<commit_before># - Try to find FFTW
# Once done this will define
#  FFTW3_FOUND - System has FFTW3
#  FFTW3_INCLUDE_DIRS - The FFTW3 include directories
#  FFTW3_LIBRARIES - The libraries needed to use FFTW3
#  FFTW3_DEFINITIONS - Compiler switches required for using FFTW3
#  FFTW3_$KIND_$PARALLEL_FOUND- Set if FFTW3 exists in KIND precision format for PARALLEL mode.
#                             where KIND can be: SINGLE, DOUBLE, LONGDOUBLE
#                             and PARALLEL: SERIAL, OPENMP, MPI, THREADS.
#  FFTW3_$KIND_$PARALLEL_LIBRARY - The libraries needed to use.
#  FFTW3_INCLUDE_DIR_PARALLEL - The FFTW3 include directories for parallels mode.

if(FFTW3_FOUND)
  return()
endif()

if(FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
  set(FFTW3_FOUND TRUE)
  foreach(component ${FFTW3_FIND_COMPONENTS})
    if("${FFTW3_${component}_LIBRARY}" STREQUAL "")
        set(FFTW3_${component}_LIBRARY "${FFTW3_LIBRARIES}")
    endif()
  endforeach()
  return()
endif()

macro(find_specific_libraries KIND PARALLEL)
  list(APPEND FFTW3_FIND_COMPONENTS ${KIND}_${PARALLEL})
  if(NOT (${PARALLEL} STREQUAL "SERIAL") AND NOT ${PARALLEL}_FOUND)
    message(FATAL_ERROR "Please, find ${PARALLEL} libraries before FFTW")
  endif()

  find_library(FFTW3_${KIND}_${PARALLEL}_LIBRARY NAMES
    fftw3${SUFFIX_${KIND}}${SUFFIX_${PARALLEL}}${SUFFIX_FINAL} HINTS ${HINT_DIRS})
  if(FFTW3_${KIND}_${PARALLEL}_LIBRARY MATCHES fftw3)
    list(APPEND FFTW3_LIBRARIES ${FFTW3_${KIND}_${PARALLEL}_LIBRARY})
    set(FFTW3_${KIND}_${PARALLEL}_FOUND TRUE)

    STRING(TOLOWER "${KIND}" kind)
    STRING(TOLOWER "${PARALLEL}" parallel)
    if(FFTW3_${kind}_${parallel}_LIBRARY MATCHES "\\.a$")
      add_library(fftw3::${kind}::${parallel} STATIC IMPORTED GLOBAL)
    else()
      add_library(fftw3::${kind}::${parallel} SHARED IMPORTED GLOBAL)
    endif()

    # MPI Has a different included library than the others
    # FFTW3_INCLUDE_DIR_PARALLEL will change depending of which on is used.
    set(FFTW3_INCLUDE_DIR_PARALLEL ${FFTW3_INCLUDE_DIR} )
    if(PARALLEL STREQUAL "MPI")
      set(FFTW3_INCLUDE_DIR_PARALLEL ${FFTW3_${PARALLEL}_INCLUDE_DIR})
    endif()

    set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
      IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
      INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}")

    # adding target properties to the different cases
    ##   MPI
    if(PARALLEL STREQUAL "MPI")
      if(MPI_C_LIBRARIES)
        set_target_properties(fftw3::${kind}::mpi PROPERTIES
          IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
          INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"
          IMPORTED_LINK_INTERFACE_LIBRARIES ${MPI_C_LIBRARIES})
      endif()
        # Below seems to be the same path than include_dir_parallel but it fails
        # if(MPI_C_INCLUDE_PATH)
        #   message(STATUS "MPI PATH: ${MPI_C_INCLUDE_PATH} VS ${FFTW3_INCLUDE_DIR_PARALLEL}")
        #   target_include_directories(fftw3::${kind}::mpi SYSTEM INTERFACE ${MPI_C_INCLUDE_PATH})
        # endif()
        # It seems the flags are not anywhere to be found
        # if(MPI_C_COMPILE_FLAGS)
        #   message(STATUS "mpi flags: ${MPI_C_COMPILE_FLAGS}")
        #   target_compile_options(fftw3::${kind}::mpi INTERFACE ${MPI_C_COMPILE_FLAGS})
        # endif()
      #endif()
    endif()
    ##   OpenMP
    if(PARALLEL STREQUAL "OPENMP")
      if(OPENMP_C_FLAGS)
        message(STATUS "OPENMP C Flags: ${OPENMP_C_FLAGS}")
        set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
           IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
           INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"
           INTERFACE_COMPILE_OPTIONS "${OPENMP_C_FLAGS}")
        endif()
    endif()
    ##  THREADS
    if(PARALLEL STREQUAL "THREADS")
      if(CMAKE_THREAD_LIBS_INIT) # TODO: this is not running
        message(STATUS "THREAD_LIBS_INITS: ${CMAKE_THREAD_LIBS_INIT}")
        set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
          IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
          INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"<commit_msg>Enforces new policy CMP0054<commit_after># - Try to find FFTW
# Once done this will define
#  FFTW3_FOUND - System has FFTW3
#  FFTW3_INCLUDE_DIRS - The FFTW3 include directories
#  FFTW3_LIBRARIES - The libraries needed to use FFTW3
#  FFTW3_DEFINITIONS - Compiler switches required for using FFTW3
#  FFTW3_$KIND_$PARALLEL_FOUND- Set if FFTW3 exists in KIND precision format for PARALLEL mode.
#                             where KIND can be: SINGLE, DOUBLE, LONGDOUBLE
#                             and PARALLEL: SERIAL, OPENMP, MPI, THREADS.
#  FFTW3_$KIND_$PARALLEL_LIBRARY - The libraries needed to use.
#  FFTW3_INCLUDE_DIR_PARALLEL - The FFTW3 include directories for parallels mode.

cmake_policy(SET CMP0054 NEW)

if(FFTW3_FOUND)
  return()
endif()

if(FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
  set(FFTW3_FOUND TRUE)
  foreach(component ${FFTW3_FIND_COMPONENTS})
    if("${FFTW3_${component}_LIBRARY}" STREQUAL "")
        set(FFTW3_${component}_LIBRARY "${FFTW3_LIBRARIES}")
    endif()
  endforeach()
  return()
endif()

macro(find_specific_libraries KIND PARALLEL)
  list(APPEND FFTW3_FIND_COMPONENTS ${KIND}_${PARALLEL})
  if(NOT (${PARALLEL} STREQUAL "SERIAL") AND NOT ${PARALLEL}_FOUND)
    message(FATAL_ERROR "Please, find ${PARALLEL} libraries before FFTW")
  endif()

  find_library(FFTW3_${KIND}_${PARALLEL}_LIBRARY NAMES
    fftw3${SUFFIX_${KIND}}${SUFFIX_${PARALLEL}}${SUFFIX_FINAL} HINTS ${HINT_DIRS})
  if(FFTW3_${KIND}_${PARALLEL}_LIBRARY MATCHES fftw3)
    list(APPEND FFTW3_LIBRARIES ${FFTW3_${KIND}_${PARALLEL}_LIBRARY})
    set(FFTW3_${KIND}_${PARALLEL}_FOUND TRUE)

    STRING(TOLOWER "${KIND}" kind)
    STRING(TOLOWER "${PARALLEL}" parallel)
    if(FFTW3_${kind}_${parallel}_LIBRARY MATCHES "\\.a$")
      add_library(fftw3::${kind}::${parallel} STATIC IMPORTED GLOBAL)
    else()
      add_library(fftw3::${kind}::${parallel} SHARED IMPORTED GLOBAL)
    endif()

    # MPI Has a different included library than the others
    # FFTW3_INCLUDE_DIR_PARALLEL will change depending of which on is used.
    set(FFTW3_INCLUDE_DIR_PARALLEL ${FFTW3_INCLUDE_DIR} )
    if(PARALLEL STREQUAL "MPI")
      set(FFTW3_INCLUDE_DIR_PARALLEL ${FFTW3_${PARALLEL}_INCLUDE_DIR})
    endif()

    set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
      IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
      INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}")

    # adding target properties to the different cases
    ##   MPI
    if(PARALLEL STREQUAL "MPI")
      if(MPI_C_LIBRARIES)
        set_target_properties(fftw3::${kind}::mpi PROPERTIES
          IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
          INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"
          IMPORTED_LINK_INTERFACE_LIBRARIES ${MPI_C_LIBRARIES})
      endif()
        # Below seems to be the same path than include_dir_parallel but it fails
        # if(MPI_C_INCLUDE_PATH)
        #   message(STATUS "MPI PATH: ${MPI_C_INCLUDE_PATH} VS ${FFTW3_INCLUDE_DIR_PARALLEL}")
        #   target_include_directories(fftw3::${kind}::mpi SYSTEM INTERFACE ${MPI_C_INCLUDE_PATH})
        # endif()
        # It seems the flags are not anywhere to be found
        # if(MPI_C_COMPILE_FLAGS)
        #   message(STATUS "mpi flags: ${MPI_C_COMPILE_FLAGS}")
        #   target_compile_options(fftw3::${kind}::mpi INTERFACE ${MPI_C_COMPILE_FLAGS})
        # endif()
      #endif()
    endif()
    ##   OpenMP
    if(PARALLEL STREQUAL "OPENMP")
      if(OPENMP_C_FLAGS)
        set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
           IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
           INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"
           INTERFACE_COMPILE_OPTIONS "${OPENMP_C_FLAGS}")
        endif()
    endif()
    ##  THREADS
    if(PARALLEL STREQUAL "THREADS")
      if(CMAKE_THREAD_LIBS_INIT) # TODO: this is not running
        set_target_properties(fftw3::${kind}::${parallel} PROPERTIES
          IMPORTED_LOCATION "${FFTW3_${KIND}_${PARALLEL}_LIBRARY}"
          INTERFACE_INCLUDE_DIRECTORIES "${FFTW3_INCLUDE_DIR_PARALLEL}"
{'fraction_non_alphanumeric': 0.1128217464517681, 'fraction_numerical': 0.013471253307673804, 'mean_word_length': 4.132716049382716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3913981', 'n_tokens_mistral': 3355, 'n_tokens_neox': 3076, 'n_words': 557}