2015-12-16 23:11:08 +01:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
|
|
|
project (uts-server)
|
2016-09-07 20:59:10 +02:00
|
|
|
include(ExternalProject)
|
|
|
|
|
2015-12-16 23:11:08 +01:00
|
|
|
|
2016-09-12 00:44:58 +02:00
|
|
|
set(VERSION 0.0.2)
|
2015-12-16 23:11:08 +01:00
|
|
|
|
2016-08-26 19:28:12 +02:00
|
|
|
option(DEBUG "compile with debug symbol" OFF)
|
2016-09-07 20:59:10 +02:00
|
|
|
option(BUNDLE_CIVETWEB "bundle civetweb with uts-server" OFF)
|
|
|
|
|
2016-08-26 19:28:12 +02:00
|
|
|
if(DEBUG)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g")
|
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
|
|
endif(DEBUG)
|
|
|
|
|
|
|
|
|
2015-12-16 23:11:08 +01:00
|
|
|
add_custom_target(tag
|
|
|
|
git tag -a "${VERSION}" -m "version ${VERSION}" &&
|
|
|
|
git push origin ${VERSION}
|
|
|
|
)
|
|
|
|
|
2015-12-17 15:48:55 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DUTS_VERSION='\"${VERSION}\"'")
|
2015-12-16 23:11:08 +01:00
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
|
|
|
|
2016-09-07 20:59:10 +02:00
|
|
|
|
|
|
|
if(BUNDLE_CIVETWEB)
|
|
|
|
ExternalProject_Add( civetweb
|
|
|
|
GIT_REPOSITORY https://github.com/civetweb/civetweb
|
|
|
|
GIT_TAG v1.8
|
|
|
|
INSTALL_DIR /usr/local
|
|
|
|
CMAKE_ARGS .. -DCMAKE_INSTALL_PREFIX=/usr
|
|
|
|
-DCIVETWEB_DISABLE_CGI=ON
|
|
|
|
-DCIVETWEB_ENABLE_CXX=OFF
|
|
|
|
-DBUILD_SHARED_LIBS=OFF
|
|
|
|
-DCIVETWEB_DISABLE_CGI=ON
|
|
|
|
-DCIVETWEB_SERVE_NO_FILES=ON
|
|
|
|
-DBUILD_TESTING=OFF
|
|
|
|
INSTALL_COMMAND make install DESTDIR=${CMAKE_CURRENT_SOURCE_DIR}/vendor/
|
|
|
|
)
|
|
|
|
set(LIBCIVETWEB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/usr/include")
|
|
|
|
set(LIBCIVETWEB_LIBRARIES "${CMAKE_CURRENT_SOURCE_DIR}/vendor/usr/lib/libcivetweb.a")
|
2016-09-07 21:33:07 +02:00
|
|
|
set (CMAKE_C_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -ldl -lpthread -lrt")
|
2016-09-07 20:59:10 +02:00
|
|
|
else(BUNDLE_CIVETWEB)
|
|
|
|
find_package(libcivetweb REQUIRED)
|
|
|
|
endif(BUNDLE_CIVETWEB)
|
2015-12-16 23:11:08 +01:00
|
|
|
|
2015-12-17 14:09:09 +01:00
|
|
|
find_package(OpenSSL REQUIRED)
|
2016-09-07 20:59:10 +02:00
|
|
|
MESSAGE(STATUS "OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
|
|
|
|
MESSAGE(STATUS "OpenSSL libraries: ${OPENSSL_LIBRARIES}")
|
2015-12-17 14:09:09 +01:00
|
|
|
|
2016-09-07 20:59:10 +02:00
|
|
|
MESSAGE( STATUS "Find Header Directory for libcivetweb: " ${LIBCIVETWEB_INCLUDE_DIR})
|
|
|
|
MESSAGE( STATUS "Find Dynamic Library for libcivetweb: " ${LIBCIVETWEB_LIBRARIES})
|
2015-12-16 23:11:08 +01:00
|
|
|
include_directories(
|
2015-12-17 21:47:41 +01:00
|
|
|
./inc/
|
2016-08-19 00:04:13 +02:00
|
|
|
${LIBCIVETWEB_INCLUDE_DIR}
|
2015-12-17 14:09:09 +01:00
|
|
|
${OPENSSL_INCLUDE_DIR}
|
2015-12-16 23:11:08 +01:00
|
|
|
)
|
|
|
|
|
2015-12-17 21:47:41 +01:00
|
|
|
add_executable(uts-server
|
|
|
|
src/cmd/uts-server.c
|
|
|
|
src/lib/rfc3161.c
|
2016-08-24 22:13:11 +02:00
|
|
|
src/lib/http.c
|
2015-12-17 21:47:41 +01:00
|
|
|
src/lib/utils.c
|
|
|
|
)
|
2015-12-16 23:11:08 +01:00
|
|
|
|
2015-12-17 14:09:09 +01:00
|
|
|
target_link_libraries(uts-server
|
|
|
|
${OPENSSL_LIBRARIES}
|
2016-09-07 20:59:10 +02:00
|
|
|
${LIBCIVETWEB_LIBRARIES}
|
2015-12-17 14:09:09 +01:00
|
|
|
)
|
2015-12-16 23:11:08 +01:00
|
|
|
|
|
|
|
INSTALL(TARGETS uts-server
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
)
|