<commit_before>list(REMOVE_DUPLICATES LIBRARIES)

foreach(LIB ${LIBRARIES})
    get_filename_component(LIBPATH ${LIB} PATH)
    list(APPEND LDFLAGS "-L${LIBPATH}")
endforeach()

list(APPEND LDFLAGS "-L${CMAKE_INSTALL_PREFIX}/lib")
list(REMOVE_DUPLICATES LDFLAGS)
TOSTRING(LDFLAGS ${LDFLAGS})

foreach(LIB ${LIBRARIES})
    get_filename_component(LIBNAME ${LIB} NAME_WE)
    STRING(REGEX REPLACE "lib" "" LIBNAME ${LIBNAME})
    list(APPEND LIBS "-l${LIBNAME}")
endforeach()
list(APPEND LIBS "-lpmr")
list(REMOVE_DUPLICATES LIBS)
TOSTRING(LIBS ${LIBS})

list(REMOVE_DUPLICATES REQUIRED_EXPORTS)
foreach(EXPORT ${REQUIRED_EXPORTS})
    list(APPEND EXPORTS "export ${EXPORT}")
endforeach()
TOSHELL(REQUIRED_EXPORTS ${EXPORTS})

execute_process(COMMAND git rev-parse --abbrev-ref HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_BRANCH
    OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(COMMAND git log -1 --format=%H
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_COMMIT_HASH
    OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(COMMAND git diff-index --name-only HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_MODIFIED
    OUTPUT_STRIP_TRAILING_WHITESPACE)

set(GIT_VERSION "${GIT_BRANCH} ${GIT_COMMIT_HASH}")
if(NOT GIT_MODIFIED STREQUAL "")
    set(GIT_VERSION "${GIT_VERSION} (modified)")
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/info.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/config/info.hpp @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/info.cpp ${CMAKE_CURRENT_BINARY_DIR}/config COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/usage.hpp ${CMAKE_CURRENT_BINARY_DIR}/config COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/usage.cpp ${CMAKE_CURRENT_BINARY_DIR}/config COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../common/parameter.hpp ${CMAKE_CURRENT_BINARY_DIR}/config COPYONLY)<commit_msg>Fix build with empty exports list<commit_after>list(REMOVE_DUPLICATES LIBRARIES)

foreach(LIB ${LIBRARIES})
    get_filename_component(LIBPATH ${LIB} PATH)
    list(APPEND LDFLAGS "-L${LIBPATH}")
endforeach()

list(APPEND LDFLAGS "-L${CMAKE_INSTALL_PREFIX}/lib")
list(REMOVE_DUPLICATES LDFLAGS)
TOSTRING(LDFLAGS ${LDFLAGS})

foreach(LIB ${LIBRARIES})
    get_filename_component(LIBNAME ${LIB} NAME_WE)
    STRING(REGEX REPLACE "lib" "" LIBNAME ${LIBNAME})
    list(APPEND LIBS "-l${LIBNAME}")
endforeach()
list(APPEND LIBS "-lpmr")
list(REMOVE_DUPLICATES LIBS)
TOSTRING(LIBS ${LIBS})

if(REQUIRED_EXPORTS)
    list(REMOVE_DUPLICATES REQUIRED_EXPORTS)
    foreach(EXPORT ${REQUIRED_EXPORTS})
        list(APPEND EXPORTS "export ${EXPORT}")
    endforeach()
    TOSHELL(REQUIRED_EXPORTS ${EXPORTS})
else()
    set(REQUIRED_EXPORTS "")
endif()

execute_process(COMMAND git rev-parse --abbrev-ref HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_BRANCH
    OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(COMMAND git log -1 --format=%H
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_COMMIT_HASH
    OUTPUT_STRIP_TRAILING_WHITESPACE)

execute_process(COMMAND git diff-index --name-only HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_MODIFIED
    OUTPUT_STRIP_TRAILING_WHITESPACE)

set(GIT_VERSION "${GIT_BRANCH} ${GIT_COMMIT_HASH}")
if(NOT GIT_MODIFIED STREQUAL "")
    set(GIT_VERSION "${GIT_VERSION} (modified)")
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/info.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/config/info.hpp @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/info.cpp ${CMAKE_CURRENT_BINARY_DIR}/config COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/usage.hpp ${CMAKE_CURRENT_BINARY_DIR}/config COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/usage.cpp ${CMAKE_CURRENT_BINARY_DIR}/config COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../common/parameter.hpp ${CMAKE_CURRENT_BINARY_DIR}/config COPYONLY)
{'fraction_non_alphanumeric': 0.1151967086654667, 'fraction_numerical': 0.0005142710208279763, 'mean_word_length': 7.294243070362473, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7462704', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1445, 'n_words': 218}