cmake_minimum_required(VERSION 3.16)
project(BinaryTable)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Core Binary Table Library
add_library(binary_table
    binary_table.h
    binary_table.cpp
)

# Main Application
add_executable(main main.cpp)
target_link_libraries(main binary_table)

# Debug Test Executables
add_executable(debug_multi_key debug/debug_multi_key.cpp)
target_link_libraries(debug_multi_key binary_table)

add_executable(debug_alloc debug/debug_alloc.cpp)
target_link_libraries(debug_alloc binary_table)

add_executable(debug_address_table debug/debug_address_table.cpp)
target_link_libraries(debug_address_table binary_table)

add_executable(debug_step_by_step debug/debug_step_by_step.cpp)
target_link_libraries(debug_step_by_step binary_table)

add_executable(debug_simple debug/debug_simple.cpp)
target_link_libraries(debug_simple binary_table)

# Compiler Settings
if(MSVC)
    target_compile_options(binary_table PRIVATE /W4)
    target_compile_options(main PRIVATE /W4)
else()
    target_compile_options(binary_table PRIVATE -Wall -Wextra -pedantic)
    target_compile_options(main PRIVATE -Wall -Wextra -pedantic)
    # Apply warnings to debug executables too
    target_compile_options(debug_multi_key PRIVATE -Wall -Wextra -pedantic)
    target_compile_options(debug_alloc PRIVATE -Wall -Wextra -pedantic)
    target_compile_options(debug_address_table PRIVATE -Wall -Wextra -pedantic)
    target_compile_options(debug_step_by_step PRIVATE -Wall -Wextra -pedantic)
    target_compile_options(debug_simple PRIVATE -Wall -Wextra -pedantic)
endif()
