cmake_minimum_required(VERSION 3.16)

project(tss-http LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
    add_compile_options(/source-charset:utf-8)
endif()

add_executable(tss-http main.cpp)
if (UNIX)
    target_link_libraries(tss-http PRIVATE pthread)
endif()

if(UNIX)
execute_process(
    COMMAND uname -a
    OUTPUT_VARIABLE UNAME_OUT
    OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(UNAME_OUT MATCHES "alpine" OR UNAME_OUT MATCHES "Alpine")
message(STATUS "tss-http on musl static link")
target_link_libraries(tss-http PRIVATE -static;-static-libstdc++)
endif()
endif()