
function(_add_define definition)
    list(APPEND _LAB_CXX_DEFINITIONS "-D${definition}")
    set(_LAB_CXX_DEFINITIONS ${_LAB_CXX_DEFINITIONS} PARENT_SCOPE)
endfunction()

function(_disable_warning flag)
    if(MSVC)
        list(APPEND _LAB_CXX_WARNING_FLAGS "/wd${flag}")
    else()
        list(APPEND _LAB_CXX_WARNING_FLAGS "-Wno-${flag}")
    endif()
    set(_LAB_CXX_WARNING_FLAGS ${_LAB_CXX_WARNING_FLAGS} PARENT_SCOPE)
endfunction()

function(_set_Cxx17 proj)
	target_compile_features(${proj} INTERFACE cxx_std_17)
endfunction()

function(_set_compile_options proj)
    if (WIN32)
        target_compile_options(${proj} PRIVATE /arch:AVX /Zi )
    endif()
    if (UNIX AND NOT APPLE)
        # target_link_libraries(${proj} pthread jack)
        target_link_libraries(${proj} pthread asound)
        # target_link_libraries(${proj} pthread pulse pulse-simple)
        target_compile_options(${proj} PRIVATE -fPIC)
        # target_compile_definitions(${proj} PRIVATE HAVE_STDINT_H=1 HAVE_SETENV=1 HAVE_SINF=1 WEBAUDIO_KISSFFT=1 __UNIX_JACK__=1)
        target_compile_definitions(${proj} PRIVATE HAVE_STDINT_H=1 HAVE_SETENV=1 HAVE_SINF=1 WEBAUDIO_KISSFFT=1)
        if("${LUMIN}" STREQUAL "1")
          target_compile_options(${proj} PRIVATE -std=c++14)
        else()
          target_compile_definitions(${proj} PRIVATE __LINUX_ALSA__=1)
        endif()
        # target_compile_definitions(${proj} PRIVATE HAVE_STDINT_H=1 HAVE_SETENV=1 HAVE_SINF=1 WEBAUDIO_KISSFFT=1 __LINUX_PULSE__=1)
    endif()
endfunction()
