<commit_before>

enable_language(Fortran)
include(cmake_modules/FindGFortran.cmake)

message(STATUS "SEARCHING FOR ARPACK IN SYSTEM...")
find_library(ARPACK_LIBRARIES
        NAMES arpack libarpack.a libarpack2.a libarpack.so libarpack2.so
        PATH_SUFFIXES lib lib32 lib64
        )

if(ARPACK_LIBRARIES)
    message(STATUS "ARPACK found in system:   ${ARPACK_LIBRARIES}")
    add_library(arpack UNKNOWN IMPORTED)
    set_target_properties(arpack
            PROPERTIES
            IMPORTED_LOCATION "${ARPACK_LIBRARIES}"
            INTERFACE_LINK_LIBRARIES "${GFORTRAN_LIB}"
            )
#    add_library(arpack INTERFACE)
#    set_target_properties(arpack
#            PROPERTIES
#            INTERFACE_LINK_LIBRARIES "${ARPACK_LIBRARIES};${GFORTRAN_LIB}"
#            )
    target_link_libraries(${PROJECT_NAME} PUBLIC arpack)
    return()
else()
    message(STATUS "Arpack-ng will be installed into ${INSTALL_DIRECTORY}/arpack-ng on first build.")

    #####################################################################
    ### Prepare lists with generator expressions, replacing all semicolons.
    ### Otherwise, passing raw lists results  in only the first element
    ### of the list to be passed.
    ####################################################################
    string (REPLACE ";" "$<SEMICOLON>" BLAS_LIBRARIES_GENERATOR     "${BLAS_LIBRARIES}")
    string (REPLACE ";" "$<SEMICOLON>" LAPACK_LIBRARIES_GENERATOR   "${LAPACK_LIBRARIES}")
    string (REPLACE ";" "$<SEMICOLON>" EXTRA_LDLAGS_GENERATOR       "${EXTRA_LDLAGS}")
    ####################################################################


    include(ExternalProject)
    ExternalProject_Add(library_ARPACK
            GIT_REPOSITORY      https://github.com/opencollab/arpack-ng.git
            GIT_TAG             master # Latest version has problems with fortran linking. so stick with this version instead.
#            GIT_TAG             3.5.0 # Latest version has problems with fortran linking. so stick with this version instead.
            PREFIX              "${INSTALL_DIRECTORY}/arpack-ng"
            UPDATE_COMMAND ""
#            BUILD_IN_SOURCE 1
#            CONFIGURE_COMMAND
#                ./bootstrap &&
#                ./configure --prefix=<INSTALL_DIR>
#            BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} && ${CMAKE_MAKE_PROGRAM} check
#            INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install

            CMAKE_ARGS
            -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
            -DCMAKE_INSTALL_MESSAGE=NEVER #Avoid unnecessary output to console
            -DCMAKE_C_FLAGS=-w
            -DEXAMPLES=ON
            -DCMAKE_BUILD_TYPE=Release
            -DMPI=OFF
            -DBUILD_SHARED_LIBS=OFF
            -DBLAS_LIBRARIES=${BLAS_LIBRARIES_GENERATOR}
            -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES_GENERATOR}
            -DEXTRA_LDLAGS=${EXTRA_LDLAGS_GENERATOR}
            DEPENDS blas lapack
            )

    ExternalProject_Get_Property(library_ARPACK INSTALL_DIR)
    set(ARPACK_INCLUDE_DIRS ${INSTALL_DIR}/include)
    add_library(arpack UNKNOWN IMPORTED)
    set_target_properties(arpack
            PROPERTIES
            IMPORTED_LOCATION ${INSTALL_DIR}/lib/libarpack${CMAKE_STATIC_LIBRARY_SUFFIX}
            INTERFACE_LINK_LIBRARIES "${GFORTRAN_LIB};${BLAS_LIBRARIES};${LAPACK_LIBRARIES}"
            INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
#    add_library(arpack INTERFACE)
#    set_target_properties(arpack
#            PROPERTIES
#            INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libarpack${CMAKE_STATIC_LIBRARY_SUFFIX};${GFORTRAN_LIB};${BLAS_LIBRARIES};${LAPACK_LIBRARIES}"
#            INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
    add_dependencies(arpack library_ARPACK)

    target_link_libraries(${PROJECT_NAME} PRIVATE arpack)
    target_include_directories(${PROJECT_NAME} PRIVATE ${ARPACK_INCLUDE_DIRS})
    #For convenience, define these variables
    get_target_property(ARPACK_LIBRARIES arpack IMPORTED_LOCATION)
endif()<commit_msg>Just the last bug<commit_after>

enable_language(Fortran)
include(cmake_modules/FindGFortran.cmake)

message(STATUS "SEARCHING FOR ARPACK IN SYSTEM...")
find_library(ARPACK_LIBRARIES
        NAMES arpack libarpack.a libarpack2.a libarpack.so libarpack2.so
        PATH_SUFFIXES lib lib32 lib64
        )

if(ARPACK_LIBRARIES)
    message(STATUS "ARPACK found in system:   ${ARPACK_LIBRARIES}")
    add_library(arpack UNKNOWN IMPORTED)
    set_target_properties(arpack
            PROPERTIES
            IMPORTED_LOCATION "${ARPACK_LIBRARIES}"
            INTERFACE_LINK_LIBRARIES "${GFORTRAN_LIB}"
            )
#    add_library(arpack INTERFACE)
#    set_target_properties(arpack
#            PROPERTIES
#            INTERFACE_LINK_LIBRARIES "${ARPACK_LIBRARIES};${GFORTRAN_LIB}"
#            )
    target_link_libraries(${PROJECT_NAME} PUBLIC arpack)
    return()
else()
    message(STATUS "Arpack-ng will be installed into ${INSTALL_DIRECTORY}/arpack-ng on first build.")

    #####################################################################
    ### Prepare lists with generator expressions, replacing all semicolons.
    ### Otherwise, passing raw lists results  in only the first element
    ### of the list to be passed.
    ####################################################################
    string (REPLACE ";" "$<SEMICOLON>" BLAS_LIBRARIES_GENERATOR     "${BLAS_LIBRARIES}")
    string (REPLACE ";" "$<SEMICOLON>" LAPACK_LIBRARIES_GENERATOR   "${LAPACK_LIBRARIES}")
    string (REPLACE ";" "$<SEMICOLON>" EXTRA_LDLAGS_GENERATOR       "${EXTRA_LDLAGS}")
    ####################################################################


    include(ExternalProject)
    ExternalProject_Add(library_ARPACK
            GIT_REPOSITORY      https://github.com/opencollab/arpack-ng.git
            GIT_TAG             master # Latest version has problems with fortran linking. so stick with this version instead.
#            GIT_TAG             3.5.0 # Latest version has problems with fortran linking. so stick with this version instead.
            PREFIX              "${INSTALL_DIRECTORY}/arpack-ng"
            UPDATE_COMMAND ""
#            BUILD_IN_SOURCE 1
#            CONFIGURE_COMMAND
#                ./bootstrap &&
#                ./configure --prefix=<INSTALL_DIR>
#            BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} && ${CMAKE_MAKE_PROGRAM} check
#            INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install

            CMAKE_ARGS
            -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
            -DCMAKE_INSTALL_MESSAGE=NEVER #Avoid unnecessary output to console
            -DCMAKE_C_FLAGS=-w
            -DEXAMPLES=ON
            -DCMAKE_BUILD_TYPE=Release
            -DMPI=OFF
            -DBUILD_SHARED_LIBS=OFF
            -DBLAS_LIBRARIES=${BLAS_LIBRARIES_GENERATOR}
            -DLAPACK_LIBRARIES=${LAPACK_LIBRARIES_GENERATOR}
            -DEXTRA_LDLAGS=${EXTRA_LDLAGS_GENERATOR}
            DEPENDS blas lapack
            )

    ExternalProject_Get_Property(library_ARPACK INSTALL_DIR)
    set(ARPACK_INCLUDE_DIRS ${INSTALL_DIR}/include)
    add_library(arpack INTERFACE)
    set_target_properties(arpack
            PROPERTIES
            INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libarpack${CMAKE_STATIC_LIBRARY_SUFFIX};${GFORTRAN_LIB};${BLAS_LIBRARIES};${LAPACK_LIBRARIES}"
            INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
#    add_library(arpack INTERFACE)
#    set_target_properties(arpack
#            PROPERTIES
#            INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libarpack${CMAKE_STATIC_LIBRARY_SUFFIX};${GFORTRAN_LIB};${BLAS_LIBRARIES};${LAPACK_LIBRARIES}"
#            INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
    add_dependencies(arpack library_ARPACK)

    target_link_libraries(${PROJECT_NAME} PRIVATE arpack)
    target_include_directories(${PROJECT_NAME} PRIVATE ${ARPACK_INCLUDE_DIRS})
    #For convenience, define these variables
    get_target_property(ARPACK_LIBRARIES arpack INTERFACE_LINK_LIBRARIES)
endif()
{'fraction_non_alphanumeric': 0.13282614118233974, 'fraction_numerical': 0.002494387627837366, 'mean_word_length': 3.2451032292218103, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2996862', 'n_tokens_mistral': 2619, 'n_tokens_neox': 2400, 'n_words': 409}