cmake_minimum_required(VERSION 3.25)

project(ke_sketches
        DESCRIPTION "sketches and small test programs for kyle's editor"
        LANGUAGES CXX
        VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_VERBOSE_MAKEFILES TRUE)
set(VERBOSE YES)

if (MSVC)
    add_compile_options("/W4" "$<$<CONFIG:RELEASE>:/O2>")
else ()
    add_compile_options(
            "-Wall"
            "-Wextra"
            "-Werror"
            "-static"
            "$<$<CONFIG:DEBUG>:-g>"
            "$<$<CONFIG:RELEASE>:-O2>")
    if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
        add_compile_options(
                "-stdlib=libc++"
                "-fsanitize=address"
                "-fno-omit-frame-pointer"
                "-fsanitize-address-use-after-scope"
        )
    else ()
        # nothing special for gcc at the moment
    endif ()
endif ()

add_executable(readFile ReadFile.cc)
add_executable(enoent enoent.cc)