# Example projects

macro(add_example appl_name)
  add_executable(${appl_name} "${appl_name}.c")
  target_link_libraries(${appl_name} PortAudio)
  if(UNIX)
    target_link_libraries(${appl_name} m)
  endif()
  set_target_properties(${appl_name} PROPERTIES FOLDER "Examples C")
  if(WIN32)
    set_property(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
  endif()
endmacro()

macro(add_example_cpp appl_name)
  add_executable(${appl_name} "${appl_name}.cpp")
  target_link_libraries(${appl_name} PortAudio)
  set_target_properties(${appl_name} PROPERTIES FOLDER "Examples C++")
  if(WIN32)
    set_property(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
  endif()
endmacro()

add_example(pa_devs)
add_example(pa_fuzz)
if(PA_USE_ASIO AND WIN32)
  add_example(paex_mono_asio_channel_select)
endif()
if(LINK_PRIVATE_SYMBOLS)
  add_example(paex_ocean_shore)
endif()
add_example(paex_pink)
add_example(paex_read_write_wire)
add_example(paex_record)
if(LINK_PRIVATE_SYMBOLS)
  add_example(paex_record_file)
endif()
add_example(paex_saw)
add_example(paex_sine)
add_example_cpp(paex_sine_c++)
if(PA_USE_WMME AND WIN32)
  add_example(paex_wmme_ac3)
  add_example(paex_wmme_surround)
endif()
add_example(paex_write_sine)
add_example(paex_write_sine_nonint)
