cmake_minimum_required(VERSION 3.0)

project(restd)

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

include (br)

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

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

file (
	GLOB_RECURSE
	source_files
	$ENV{SRC_DIR}/src/prog/restd/src/main.cpp
	$ENV{SRC_DIR}/src/prog/restd/src/authorize.cpp
	$ENV{SRC_DIR}/src/prog/restd/src/session.cpp
	$ENV{SRC_DIR}/src/prog/restd/src/message.cpp
	$ENV{SRC_DIR}/src/prog/restd/src/routes/ExitHandler.cpp
	$ENV{SRC_DIR}/src/prog/restd/src/routes/UbusHandler.cpp
)

add_executable (restd ${source_files})

target_link_libraries (restd 
	LINK_PUBLIC
	pthread
	dl
	crypt
	ubus
	ubus-cpp
	json-cpp
	civetweb-cpp
)

install (TARGETS restd DESTINATION local/bin)

#add_custom_command(
#    TARGET restd
#    POST_BUILD
#    COMMAND cp ${CMAKE_SOURCE_DIR}/certificate/ssl_cert.pem ${CMAKE_SOURCE_DIR}/build/
# )
