Added install functionality to CMake

This commit is contained in:
Stefan Ritt 2019-05-26 12:01:19 +02:00
parent 8feac9079a
commit 641cae31dd
2 changed files with 39 additions and 4 deletions

View File

@ -8,6 +8,12 @@ option(USE_KRB5 "Use Kerberos library for authentication" OFF)
option(USE_LDAP "Use LDAP library for authentication" OFF)
option(USE_PAM "Use PAM library for authentication" OFF)
# install directory
set(CMAKE_INSTALL_PREFIX /usr/local)
set(ELOGDIR ${CMAKE_INSTALL_PREFIX}/elog)
set(RCDIR /etc/rc.d/init.d)
set(SRVDIR /usr/lib/systemd/system)
#----------------------------------
include_directories(${CMAKE_SOURCE_DIR}/mxml)
@ -89,10 +95,6 @@ add_executable(elog
${GIT_REVISION_TMP}
)
if (${CMAKE_SYSTEM_NAME} MATCHES Darwin)
# message("On DARWIN")
endif()
if(USE_SSL)
target_link_libraries(elogd ${OPENSSL_LIBRARIES})
target_link_libraries(elog ${OPENSSL_LIBRARIES})
@ -106,3 +108,36 @@ endif(USE_LDAP)
if(USE_PAM)
target_link_libraries(elogd ${PAM_LIBRARIES})
endif(USE_PAM)
install(TARGETS elog
DESTINATION bin)
install(FILES ${CMAKE_SOURCE_DIR}/man/elog.1
DESTINATION man/man1)
install(FILES ${CMAKE_SOURCE_DIR}/man/elogd.8
DESTINATION man/man8)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/scripts
${CMAKE_SOURCE_DIR}/resources
${CMAKE_SOURCE_DIR}/themes
MESSAGE_NEVER
DESTINATION ${ELOGDIR})
install(FILES ${CMAKE_SOURCE_DIR}/ssl/server.crt
${CMAKE_SOURCE_DIR}/ssl/server.key
DESTINATION ${ELOGDIR}/ssl/)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/logbooks/demo
MESSAGE_NEVER
DESTINATION ${ELOGDIR}/logbooks)
install(FILES ${CMAKE_SOURCE_DIR}/elogd.cfg.example
RENAME elogd.cfg
DESTINATION ${ELOGDIR})
if (${CMAKE_SYSTEM_NAME} MATCHES Darwin)
install(FILES ${CMAKE_SOURCE_DIR}/elogd.plist
DESTINATION /Library/LaunchDaemons/ch.psi.chelogd.plist)
install(CODE "message(\"\nThe elogd servie can be started with:\")")
install(CODE "message(\"$ sudo launchctl load /Library/LaunchDaemons/ch.psi.ch.elogd.plist\n\")")
#install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan
# \"$ sudo launchctl load /Library/LaunchDaemons/ch.psi.ch.elogd.plist\")")
endif()