set(
        CLP_SOURCES
        ../ArrayBackedPosIntSet.hpp
        ../BufferedFileReader.cpp
        ../BufferedFileReader.hpp
        ../BufferReader.cpp
        ../BufferReader.hpp
        ../database_utils.cpp
        ../database_utils.hpp
        ../Defs.h
        ../dictionary_utils.cpp
        ../dictionary_utils.hpp
        ../DictionaryEntry.hpp
        ../DictionaryReader.hpp
        ../DictionaryWriter.hpp
        ../EncodedVariableInterpreter.cpp
        ../EncodedVariableInterpreter.hpp
        ../ErrorCode.hpp
        ../ffi/encoding_methods.cpp
        ../ffi/encoding_methods.hpp
        ../ffi/encoding_methods.inc
        ../ffi/ir_stream/byteswap.hpp
        ../ffi/ir_stream/decoding_methods.cpp
        ../ffi/ir_stream/decoding_methods.hpp
        ../ffi/ir_stream/decoding_methods.inc
        ../ffi/ir_stream/encoding_methods.cpp
        ../ffi/ir_stream/encoding_methods.hpp
        ../ffi/ir_stream/utils.cpp
        ../ffi/ir_stream/utils.hpp
        ../FileDescriptor.cpp
        ../FileDescriptor.hpp
        ../FileReader.cpp
        ../FileReader.hpp
        ../FileWriter.cpp
        ../FileWriter.hpp
        ../GlobalMetadataDB.hpp
        ../GlobalMetadataDBConfig.cpp
        ../GlobalMetadataDBConfig.hpp
        ../GlobalMySQLMetadataDB.cpp
        ../GlobalMySQLMetadataDB.hpp
        ../GlobalSQLiteMetadataDB.cpp
        ../GlobalSQLiteMetadataDB.hpp
        ../ir/constants.hpp
        ../ir/EncodedTextAst.cpp
        ../ir/EncodedTextAst.hpp
        ../ir/LogEvent.hpp
        ../ir/LogEventDeserializer.cpp
        ../ir/LogEventDeserializer.hpp
        ../ir/LogEventSerializer.cpp
        ../ir/LogEventSerializer.hpp
        ../ir/parsing.cpp
        ../ir/parsing.hpp
        ../ir/parsing.inc
        ../ir/types.hpp
        ../ir/utils.cpp
        ../ir/utils.hpp
        ../LibarchiveFileReader.cpp
        ../LibarchiveFileReader.hpp
        ../LibarchiveReader.cpp
        ../LibarchiveReader.hpp
        ../LogSurgeonReader.cpp
        ../LogSurgeonReader.hpp
        ../LogTypeDictionaryEntry.cpp
        ../LogTypeDictionaryEntry.hpp
        ../LogTypeDictionaryReader.hpp
        ../LogTypeDictionaryWriter.cpp
        ../LogTypeDictionaryWriter.hpp
        ../math_utils.hpp
        ../MessageParser.cpp
        ../MessageParser.hpp
        ../MySQLDB.cpp
        ../MySQLDB.hpp
        ../MySQLParamBindings.cpp
        ../MySQLParamBindings.hpp
        ../MySQLPreparedStatement.cpp
        ../MySQLPreparedStatement.hpp
        ../PageAllocatedVector.hpp
        ../ParsedMessage.cpp
        ../ParsedMessage.hpp
        ../Platform.hpp
        ../Profiler.cpp
        ../Profiler.hpp
        ../Query.cpp
        ../Query.hpp
        ../ReaderInterface.cpp
        ../ReaderInterface.hpp
        ../ReadOnlyMemoryMappedFile.cpp
        ../ReadOnlyMemoryMappedFile.hpp
        ../spdlog_with_specializations.hpp
        ../SQLiteDB.cpp
        ../SQLiteDB.hpp
        ../SQLitePreparedStatement.cpp
        ../SQLitePreparedStatement.hpp
        ../Stopwatch.cpp
        ../Stopwatch.hpp
        ../streaming_archive/ArchiveMetadata.cpp
        ../streaming_archive/ArchiveMetadata.hpp
        ../streaming_archive/Constants.hpp
        ../streaming_archive/MetadataDB.cpp
        ../streaming_archive/MetadataDB.hpp
        ../streaming_archive/reader/Archive.cpp
        ../streaming_archive/reader/Archive.hpp
        ../streaming_archive/reader/File.cpp
        ../streaming_archive/reader/File.hpp
        ../streaming_archive/reader/Message.cpp
        ../streaming_archive/reader/Message.hpp
        ../streaming_archive/reader/Segment.cpp
        ../streaming_archive/reader/Segment.hpp
        ../streaming_archive/reader/SegmentManager.cpp
        ../streaming_archive/reader/SegmentManager.hpp
        ../streaming_archive/writer/Archive.cpp
        ../streaming_archive/writer/Archive.hpp
        ../streaming_archive/writer/File.cpp
        ../streaming_archive/writer/File.hpp
        ../streaming_archive/writer/Segment.cpp
        ../streaming_archive/writer/Segment.hpp
        ../streaming_archive/writer/utils.cpp
        ../streaming_archive/writer/utils.hpp
        ../streaming_compression/Compressor.hpp
        ../streaming_compression/Constants.hpp
        ../streaming_compression/Decompressor.hpp
        ../streaming_compression/passthrough/Compressor.cpp
        ../streaming_compression/passthrough/Compressor.hpp
        ../streaming_compression/passthrough/Decompressor.cpp
        ../streaming_compression/passthrough/Decompressor.hpp
        ../streaming_compression/zstd/Compressor.cpp
        ../streaming_compression/zstd/Compressor.hpp
        ../streaming_compression/zstd/Constants.hpp
        ../streaming_compression/zstd/Decompressor.cpp
        ../streaming_compression/zstd/Decompressor.hpp
        ../StringReader.cpp
        ../StringReader.hpp
        ../time_types.hpp
        ../TimestampPattern.cpp
        ../TimestampPattern.hpp
        ../TraceableException.hpp
        ../type_utils.hpp
        ../utf8_utils.cpp
        ../utf8_utils.hpp
        ../Utils.cpp
        ../Utils.hpp
        ../VariableDictionaryEntry.cpp
        ../VariableDictionaryEntry.hpp
        ../VariableDictionaryReader.hpp
        ../VariableDictionaryWriter.cpp
        ../VariableDictionaryWriter.hpp
        ../version.hpp
        ../WriterInterface.cpp
        ../WriterInterface.hpp
        "${PROJECT_SOURCE_DIR}/submodules/sqlite3/sqlite3.c"
        "${PROJECT_SOURCE_DIR}/submodules/sqlite3/sqlite3.h"
        clp.cpp
        CommandLineArguments.cpp
        CommandLineArguments.hpp
        compression.cpp
        compression.hpp
        decompression.cpp
        decompression.hpp
        FileCompressor.cpp
        FileCompressor.hpp
        FileDecompressor.cpp
        FileDecompressor.hpp
        run.cpp
        run.hpp
        utils.cpp
        utils.hpp
)

add_executable(clp ${CLP_SOURCES})
target_compile_features(clp PRIVATE cxx_std_20)
target_include_directories(clp PRIVATE "${PROJECT_SOURCE_DIR}/submodules")
target_link_libraries(clp
        PRIVATE
        Boost::filesystem Boost::program_options
        fmt::fmt
        log_surgeon::log_surgeon
        spdlog::spdlog
        ${sqlite_LIBRARY_DEPENDENCIES}
        LibArchive::LibArchive
        MariaDBClient::MariaDBClient
        ${STD_FS_LIBS}
        clp::string_utils
        yaml-cpp::yaml-cpp
        ZStd::ZStd
)
# Put the built executable at the root of the build directory
set_target_properties(
        clp
        PROPERTIES
        RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)
