cmake_minimum_required(VERSION 3.21)

# set the project name
project(connecttoreader VERSION 1.0 LANGUAGES CXX)

if(PROJECT_IS_TOP_LEVEL)
    find_package(ilreaders REQUIRED)
endif()

# add the ILReaders library
include_directories(${HEADERS_DIRECTORY})

# add the executable
add_executable(${PROJECT_NAME} 
    ${PROJECT_SOURCE_DIR}/main.cpp
    ${HEADERS_DIRECTORY}/ilr_cpp_helpers.cpp)

# Find and link library
find_library(ILREADERS NAMES ilreaders PATHS ${MYLIB_DIRECTORY})
target_link_libraries(${PROJECT_NAME} PRIVATE ilreaders::ilreaders)

    target_compile_options(${PROJECT_NAME} PUBLIC 
        -fsanitize=address
        -fno-omit-frame-pointer)
    target_link_options(${PROJECT_NAME} PUBLIC 
        -fsanitize=address -static-libasan)
