cmake_minimum_required(VERSION 2.8.11)

project(restd)

include (libcivetweb)
include (libjsoncpp)
include (libubus)
include (libubox)
include (libubuscpp)

include_directories(../../src)

set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -pedantic -Werror=strict-aliasing")

file (
	GLOB_RECURSE
	source_files
	../../src/main.cpp
	../../src/authorize.cpp
	../../src/session.cpp
	../../src/message.cpp
	../../src/routes/ExitHandler.cpp
	../../src/routes/UbusHandler.cpp
)

add_executable (
        restd
        ${source_files}
)

target_link_libraries (restd 
	LINK_PUBLIC
	civetweb
	ubus
	ubuscpp
	dl
	crypt
	jsoncpp
)


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