cmake_minimum_required(VERSION 3.10)
cmake_policy(SET CMP0091 NEW)
project(Argtable3Sample C)

set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED True)

option(USE_STATIC_RUNTIME "Use static runtime (/MT or /MTd)" OFF)

find_package(Argtable3 CONFIG REQUIRED)
add_executable(sample sample.c)
target_link_libraries(sample PRIVATE argtable3::argtable3)

if(MSVC)
    if(USE_STATIC_RUNTIME)
        set(runtime "MultiThreaded$<$<CONFIG:Debug>:Debug>")
    else()
        set(runtime "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
    endif()
    set_target_properties(sample PROPERTIES MSVC_RUNTIME_LIBRARY "${runtime}")
endif()
