2013-11-08 22:32:07 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
2018-05-24 16:10:11 +00:00
|
|
|
project (mympd C)
|
2014-01-08 01:22:05 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
|
2018-05-24 18:09:24 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR "2")
|
2018-05-29 21:20:14 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR "2")
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
2014-11-11 20:13:11 +00:00
|
|
|
if(CMAKE_BUILD_TYPE MATCHES RELEASE)
|
|
|
|
set(ASSETS_PATH "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/htdocs")
|
|
|
|
else()
|
|
|
|
set(ASSETS_PATH "${PROJECT_SOURCE_DIR}/htdocs")
|
|
|
|
endif()
|
2014-02-16 18:46:53 +00:00
|
|
|
|
2014-10-19 17:52:23 +00:00
|
|
|
option(WITH_IPV6 "enable IPv6 support" ON)
|
2015-09-27 12:33:37 +00:00
|
|
|
option(WITH_SSL "enable SSL support" ON)
|
2013-11-12 01:51:39 +00:00
|
|
|
|
|
|
|
find_package(LibMPDClient REQUIRED)
|
2014-02-16 18:46:53 +00:00
|
|
|
find_package(Threads REQUIRED)
|
2014-01-08 01:22:05 +00:00
|
|
|
|
2014-02-22 00:57:26 +00:00
|
|
|
configure_file(src/config.h.in ${PROJECT_BINARY_DIR}/config.h)
|
2015-04-24 21:38:39 +00:00
|
|
|
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${LIBMPDCLIENT_INCLUDE_DIR})
|
2014-01-08 01:22:05 +00:00
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
|
2017-05-14 05:37:46 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -pedantic")
|
2014-10-19 17:52:23 +00:00
|
|
|
if(WITH_IPV6)
|
2014-11-11 20:13:11 +00:00
|
|
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NS_ENABLE_IPV6)
|
2014-10-19 17:52:23 +00:00
|
|
|
endif()
|
2015-09-27 12:33:37 +00:00
|
|
|
if(WITH_SSL)
|
|
|
|
find_package(OpenSSL REQUIRED)
|
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
|
|
# list(APPEND LIB_LIST ${OPENSSL_LIBRARIES})
|
|
|
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NS_ENABLE_SSL)
|
|
|
|
endif()
|
2013-11-12 01:51:39 +00:00
|
|
|
|
2014-02-22 00:57:26 +00:00
|
|
|
file(GLOB RESOURCES
|
2014-11-11 20:13:11 +00:00
|
|
|
RELATIVE ${PROJECT_SOURCE_DIR}
|
|
|
|
htdocs/js/*
|
|
|
|
htdocs/assets/*
|
2016-02-13 20:58:43 +00:00
|
|
|
htdocs/css/*.css
|
2014-11-11 20:13:11 +00:00
|
|
|
htdocs/fonts/*
|
|
|
|
htdocs/index.html
|
2015-10-21 17:24:38 +00:00
|
|
|
htdocs/player.html
|
2014-02-16 18:46:53 +00:00
|
|
|
)
|
|
|
|
|
2013-11-12 01:51:39 +00:00
|
|
|
set(SOURCES
|
2018-05-24 17:50:05 +00:00
|
|
|
src/mympd.c
|
2013-11-08 22:32:07 +00:00
|
|
|
src/mpd_client.c
|
2014-02-16 18:46:53 +00:00
|
|
|
src/mongoose.c
|
2014-02-22 01:11:45 +00:00
|
|
|
src/json_encode.c
|
2013-11-13 14:30:54 +00:00
|
|
|
)
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2018-05-24 16:10:11 +00:00
|
|
|
add_executable(mympd ${SOURCES})
|
|
|
|
target_link_libraries(mympd ${LIBMPDCLIENT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES})
|
2013-11-08 22:32:07 +00:00
|
|
|
|
2018-05-24 16:10:11 +00:00
|
|
|
install(TARGETS mympd DESTINATION bin)
|
|
|
|
install(FILES mympd.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
|
2018-05-24 16:26:07 +00:00
|
|
|
install(DIRECTORY htdocs DESTINATION share/${PROJECT_NAME})
|