<commit_before>cmake_minimum_required(VERSION 2.8.4)
project(zindex)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -Wall -Werror")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")

option(UseLTO "Use link-time optimization" OFF)
option(Static "Statically link" OFF)

if(UseLTO)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-linker-plugin -fuse-ld=gold")
endif(UseLTO)

if(Static)
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_OMIT_LOAD_EXTENSION=1")
    set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
    set(BUILD_SHARED_LIBRARIES OFF)
endif(Static)

find_package(ZLIB REQUIRED)
include_directories(BEFORE SYSTEM ext/sqlite)
include_directories(${ZLIB_INCLUDE_DIRS} src ext)

set(SOURCE_FILES
    src/File.h
    src/Index.cpp
    src/Index.h
    src/LineFinder.cpp
    src/LineFinder.h
    src/LineSink.h
    src/Sqlite.cpp
    src/Sqlite.h
    src/SqliteError.h
    src/RegExp.h
    src/RegExp.cpp
    src/RegExpIndexer.cpp
    src/RegExpIndexer.h
    src/LineIndexer.h
    src/IndexSink.h
    src/Log.h
    src/StdoutLog.h
    src/StdoutLog.cpp
    src/StringView.cpp
    src/StringView.h
    ext/sqlite/sqlite3.c)

set(TEST_FILES
    tests/catch.hpp
    tests/LineFinderTest.cpp
    tests/test_main.cpp
    tests/SqliteTest.cpp 
    tests/RegExpTest.cpp
    tests/RegExpIndexerTest.cpp
    tests/TempDir.h
    tests/TempDir.cpp
    tests/IndexTest.cpp
    tests/LogTest.cpp)

add_library(libzindex ${SOURCE_FILES})

add_executable(zindex src/zindex.cpp)
target_link_libraries(zindex libzindex ${ZLIB_LIBRARIES} dl)
add_executable(zq src/zq.cpp)
target_link_libraries(zq libzindex ${ZLIB_LIBRARIES} dl)<commit_msg>Give the library a more apropriate name<commit_after>cmake_minimum_required(VERSION 2.8.4)
project(zindex)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -Wall -Werror")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")

option(UseLTO "Use link-time optimization" OFF)
option(Static "Statically link" OFF)

if(UseLTO)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-linker-plugin -fuse-ld=gold")
endif(UseLTO)

if(Static)
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -static-libgcc -static-libstdc++")
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_OMIT_LOAD_EXTENSION=1")
    set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
    set(BUILD_SHARED_LIBRARIES OFF)
endif(Static)

find_package(ZLIB REQUIRED)
include_directories(BEFORE SYSTEM ext/sqlite)
include_directories(${ZLIB_INCLUDE_DIRS} src ext)

set(SOURCE_FILES
    src/File.h
    src/Index.cpp
    src/Index.h
    src/LineFinder.cpp
    src/LineFinder.h
    src/LineSink.h
    src/Sqlite.cpp
    src/Sqlite.h
    src/SqliteError.h
    src/RegExp.h
    src/RegExp.cpp
    src/RegExpIndexer.cpp
    src/RegExpIndexer.h
    src/LineIndexer.h
    src/IndexSink.h
    src/Log.h
    src/StdoutLog.h
    src/StdoutLog.cpp
    src/StringView.cpp
    src/StringView.h
    ext/sqlite/sqlite3.c)

set(TEST_FILES
    tests/catch.hpp
    tests/LineFinderTest.cpp
    tests/test_main.cpp
    tests/SqliteTest.cpp 
    tests/RegExpTest.cpp
    tests/RegExpIndexerTest.cpp
    tests/TempDir.h
    tests/TempDir.cpp
    tests/IndexTest.cpp
    tests/LogTest.cpp)

add_library(libzindex ${SOURCE_FILES})
set_target_properties(libzindex PROPERTIES OUTPUT_NAME zindex)

add_executable(zindex src/zindex.cpp)
target_link_libraries(zindex libzindex ${ZLIB_LIBRARIES} dl)
add_executable(zq src/zq.cpp)
target_link_libraries(zq libzindex ${ZLIB_LIBRARIES} dl)
{'fraction_non_alphanumeric': 0.11019867549668874, 'fraction_numerical': 0.003708609271523179, 'mean_word_length': 4.266387726638773, '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': '452550', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1525, 'n_words': 213}