add_executable (i2c_HMC5883L i2c_HMC5883L.c)
add_executable (hellomraa hellomraa.c)
add_executable (cycle-pwm3 cycle-pwm3.c)
add_executable (blink-io blink-io.c)
add_executable (analogin_a0 analogin_a0.c)
add_executable (isr_pin6 isr_pin6.c)
add_executable (gpio_read6 gpio_read6.c)
add_executable (spi_mcp4261 spi_mcp4261.c)
add_executable (mmap-io2 mmap-io2.c)
add_executable (blink_onboard blink_onboard.c)
add_executable (uart uart.c)
add_executable (mraa-gpio mraa-gpio.c)
add_executable (mraa-i2c mraa-i2c.c)
add_executable (spi_max7219 spi_max7219.c)
add_executable (iio_driver iio_driver.c)

include_directories(${PROJECT_SOURCE_DIR}/api)
# FIXME Hack to access mraa internal types used by mraa-i2c
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/api/mraa)

target_link_libraries (hellomraa mraa)
target_link_libraries (i2c_HMC5883L mraa m)
target_link_libraries (cycle-pwm3 mraa)
target_link_libraries (blink-io mraa)
target_link_libraries (analogin_a0 mraa)
target_link_libraries (isr_pin6 mraa)
target_link_libraries (gpio_read6 mraa)
target_link_libraries (spi_mcp4261 mraa)
target_link_libraries (mmap-io2 mraa)
target_link_libraries (blink_onboard mraa)
target_link_libraries (uart mraa)
target_link_libraries (mraa-gpio mraa)
target_link_libraries (mraa-i2c mraa)
target_link_libraries (spi_max7219 mraa)
target_link_libraries (iio_driver mraa)

add_subdirectory (c++)

install (DIRECTORY ${PROJECT_SOURCE_DIR}/examples/ DESTINATION ${CMAKE_INSTALL_DATADIR}/mraa/examples)

if (INSTALLGPIOTOOL)
   install (TARGETS mraa-gpio DESTINATION bin)
endif()