cmake_minimum_required (VERSION 3.0)

project (sprinklerd)

set (CMAKE_MODULE_PATH "${MODULE_PATH}")
set (CMAKE_CXX_STANDARD 11)

include (br)

include_directories ($ENV{SRC_DIR}/src/prog/sprinklerd)

set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Werror=strict-aliasing")

file(
	GLOB_RECURSE
	source_files

	$ENV{SRC_DIR}/src/prog/sprinklerd/src/main.cpp
	$ENV{SRC_DIR}/src/prog/sprinklerd/src/ubus-sprinkler-model.cpp
	$ENV{SRC_DIR}/src/prog/sprinklerd/src/sprinklers.cpp
)

add_executable (sprinklerd ${source_files})

target_link_libraries (sprinklerd 
	LINK_PUBLIC
	ubus-cpp	
	json-cpp
	ubox
	ubus
	blobmsg_json
	rt
)

install (TARGETS sprinklerd DESTINATION local/bin)