set (daemon_src bootdaemon.c)

# Make build flags compiler specific
if (CMAKE_COMPILER_IS_GNUCC)
	if (CMAKE_BUILD_TYPE STREQUAL "Debug")
		set (CMAKE_C_FLAGS "-D_REETRANT -ggdb -fPIC -Wall -Wextra -pedantic -O0 -lwiringPi")
	elseif( CMAKE_BUILD_TYPE STREQUAL "Release" )
		set (CMAKE_C_FLAGS "-D_REETRANT -DNDEBUG -fPIC -Wall -Wextra -pedantic -O3 -lwiringPi")
	endif ()
endif (CMAKE_COMPILER_IS_GNUCC)

add_executable (bootdaemon ${daemon_src})

# The rule to install daemon binary
install (TARGETS bootdaemon
	RUNTIME
	DESTINATION bin)